本文介绍了等同于各种Unices上的fesetflushtozero()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HP-UX的libc具有 中的 __ fpscr_flush_to_zero 位来将VFP指令(而不是NEON) code>对象并使用 fesetenv()安装该环境。
  • iOS / arm64: fesetenv(_FE_DFL_DISABLE_DENORMS_ENV)。



  • HP-UX's libc has the function fesetflushtozero to switch floating-point behavior between "gradual underflow" and "flush to zero".

    Despite combing through documentation and man pages of several Unix libc's (including glibc), I have yet to find how to achieve the same thing in other Unices. I'm particularly interest in Linux/glibc, Solaris and AIX.

    解决方案

    As you have doubtless noted, there’s no standard way to do this (for that matter, there’s no standard definition of "flush to zero", nor any requirement that hardware implement it). So all of the means of doing this are platform-specific. To add a few more to the list, since this is a useful reference:

    • OSX / Intel: fesetenv(_FE_DFL_DISABLE_SSE_DENORMS_ENV). Note that this only effects arithmetic done in float or double, which is done using SSE2 (hence the name); long double arithmetic is performed using the legacy x87 instructions, which do not support flushing.

    • iOS / arm: On 32-bit ARM under iOS, flush-to-zero is the default mode. You can turn it off for VFP instructions (but not for NEON) by clearing the __fpscr_flush_to_zero bit in a fenv_t object and installing that environment with fesetenv( ).

    • iOS / arm64: fesetenv(_FE_DFL_DISABLE_DENORMS_ENV).

    这篇关于等同于各种Unices上的fesetflushtozero()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    09-05 08:55