在Mac OS X上,libmath的$ fenv_access_off函数是什么? [英] What are the $fenv_access_off functions of libmath on Mac OS X?

查看:95
本文介绍了在Mac OS X上,libmath的$ fenv_access_off函数是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Mountain Lion's implementation of libmath (located at /usr/lib/system/libsystem_m.dylib) has all the standard libmath functions, plus, for each of them, a $fenv_access_off variation. For instance, there's acos, and acos$fenv_access_off. (I do not have any other version of Mac OS installed available to check if it was the case before 10.8.)

$fenv_access_off是什么意思?

我知道我永远不会直接打电话给任何人,但我仍然对它们感到好奇.

I understand that I won't ever be calling directly any of these, but I'm still curious about them.

推荐答案

有一个邮件列表线程,其中包含有关fenv_access_off的讨论.苹果工程师斯蒂芬·佳能(Stephen Canon)解释:

There is a mailing list thread between some of Apple's engineers that contains a discussion about fenv_access_off. Stephen Canon, an Apple engineer, explains:

C99知道您是否正在查找IEEE标志/正在更改舍入 模式是否取决于您是否包含fenv.h并完成 #pragma STDC FENV_ACCESS是否按标准要求打开. 因此,原则上,我们实际上可以有两个并行的数学库,一个 花时间努力设置标志和防御 舍入模式会更改,而更快的模式则不会.在实践中, 这可以通过使用一组单独的符号来实现 用$ fenv_access_off修饰数学库中的所有内容.

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.

来自fenvman page:

标头声明要提供的类型,宏和函数 访问浮点环境,包括 浮点状态标志和控制模式所支持的 实施.

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.

...

FENV_ACCESS编译指示提供了一种方法来通知编译器: 该程序可能会访问浮点环境以测试状态 标记或更改控制模式.

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.

这篇关于在Mac OS X上,libmath的$ fenv_access_off函数是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆