For faster navigation, this Iframe is preloading the Wikiwand page for fenv.h.

fenv.h

fenv.hC标准函数库中的头文件,提供了对浮点环境的支持。浮点环境(floating-point environment)是指任何实现支持的浮点状态标志与控制模式。浮点状态标志(floating-point status flag)是一个系统变量,当浮点异常被抛出时该系统变量被置位。浮点控制模式(floating-point control mode)是一个系统变量,用户可以对其置位,以影响随后的浮点运算行为。

类型

[编辑]
  • fenv_t 表示整体浮点环境
  • fexcept_t 表示浮点状态的集合

[编辑]
  • 表示各种浮点运算异常:
    • FE_DIVBYZERO
    • FE_INEXACT
    • FE_INVALID
    • FE_OVERFLOW
    • FE_UNDERFLOW
    • FE_ALL_EXCEPT
  • 近似舍入方法
    • FE_DOWNWARD
    • FE_TONEAREST
    • FE_TOWARDZERO
    • FE_UPWARD
  • 缺省浮点环境
    • FE_DFL_ENV

函数

[编辑]
  • feclearexcept 清除给定的浮点异常
  • fegetexceptflag 保存一个浮点状态标志到对象中
  • feraiseexcept 抛出一个浮点异常
  • fesetexceptflag 设置一个浮点状态标志到对象中
  • fetestexcept 测试那些浮点异常标志被置位
  • fegetround 获取当前近似舍入方法
  • fesetround 设置近似舍入方法
  • fegetenv 存储当前浮点环境到对象中
  • feholdexcept 存储当前浮点环境到对象中,清楚浮点状态标志,安装non-stop模式
  • fesetenv 从对象存储的浮点环境恢复现场
  • feupdateenv 保存当前浮点异常,从对象存储的浮点环境恢复现场,再重新抛出当前浮点异常

参考文献

[编辑]
{{bottomLinkPreText}} {{bottomLinkText}}
fenv.h
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?