gpt4 book ai didi

macos - Mac OS X 上 libmath 的 $fenv_access_off 函数是什么?

转载 作者:行者123 更新时间:2023-12-02 22:25:00 25 4
gpt4 key购买 nike

Mountain Lion 的 libmath 实现(位于/usr/lib/system/libsystem_m.dylib)具有所有标准的 libmath 函数,此外,对于每个函数,还有一个 $fenv_access_off 变体。例如,有 acosacos$fenv_access_off。 (我没有安装任何其他版本的 Mac OS 可用于检查是否是 10.8 之前的情况。)

$fenv_access_off 是什么意思?

我知道我永远不会直接调用其中任何一个,但我仍然对它们感到好奇。

最佳答案

有一个mailing list thread一些 Apple 工程师之间包含有关 fenv_access_off 的讨论。 Apple 工程师 Stephen Canon 解释说:

C99 knows whether you are looking the IEEE flags / changing rounding modes or not based on whether or not you've included fenv.h and done #pragma STDC FENV_ACCESS on or not, as required by standard. So in principle, we could actually have two parallel math libraries, one that spends time diligently setting flags and defending against rounding mode changes and a faster one that does not. In practice, this can be just implemented by having a separate set of symbols decorated with $fenv_access_off for all the stuff in the math library.

来自 fenv手册页:

The header declares types, macros, and functions to provide access to the floating-point environment, consisting of any floating-point status flags and control modes supported by the implementation.

...

The FENV_ACCESS pragma provides a means to inform the compiler that the program might access the floating-point environment to test status flags or change the control modes.

关于macos - Mac OS X 上 libmath 的 $fenv_access_off 函数是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13096137/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com