Floating-point environment
来自cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
浮点环境的浮点状态标志的设置和控制方式实现支持。它是本地线程,每个线程都会继承父线程的初始状态,其浮点环境。浮点运算修改浮点状态标志,用于指示异常结果或辅助信息。浮点控制模式的状态会影响一些浮点运算的结果.
Original:
The floating-point environment is the set of floating-point status flags and control modes supported by the implementation. It is thread-local, each thread inherits the initial state of its floating-point environment from the parent thread. Floating-point operations modify the floating-point status flags to indicate abnormal results or auxiliary information. The state of floating-point control modes affects the outcomes of some floating-point operations.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
浮点环境访问和修改是唯一有意义的
#pragma STDC FENV_ACCESS设置为
ON。否则,执行是免费的假设,浮点控制模式始终是默认的,浮点状态标志从来没有测试或修改。在实践中,一些现有的编译器支持#pragma明确,但大多数编译器允许反正有意义的访问浮点环境.Original:
The floating-point environment access and modification is only meaningful when
#pragma STDC FENV_ACCESS is set to
ON. Otherwise the implementation is free to assume that floating-point control modes are always the default ones and that floating-point status flags are never tested or modified. In practice, few current compilers support the #pragma explicitly, but most compilers allow meaningful access to the floating-point environment anyway.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目录 |
[编辑] 类型
| Defined in header
<cfenv> | |
| fenv_t | 类型代表整个浮点环境
Original: The type representing the entire floating-point environment The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| fexcept_t | 该型集体所有的浮点状态标志
Original: The type representing all floating-point status flags collectively The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[编辑] 功能
| (C++11) |
清除指定的浮点状态标志 Original: clears the specified floating-point status flags The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
| (C++11) |
确定哪些指定浮点状态标志被设置 Original: determines which of the specified floating-point status flags are set The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
| (C++11) |
提出了指定的浮点异常 Original: raises the specified floating-point exceptions The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
| (C++11) (C++11) |
复制或浮点环境指定的浮点状态标志的状态 Original: copies the state of the specified floating-point status flags from or to the floating-point environment The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
| (C++11) (C++11) |
获取或设置舍入的方向 Original: gets or sets rounding direction The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
| (C++11) |
保存或恢复当前浮点环境 Original: saves or restores the current floating point environment The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
| (C++11) |
保存环境,清除所有状态标志,而忽略了未来所有的错误 Original: saves the environment, clears all status flags and ignores all future errors The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
| (C++11) |
浮点环境恢复和提高了先前抛出异常 Original: restores the floating-point environment and raises the previously raise exceptions The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
[编辑] 宏
| 浮点异常 Original: floating-point exceptions The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (宏不变) | |
| 浮点舍入方向 Original: floating-point rounding direction The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (宏不变) | |
| (C++11) |
默认的浮点环境 Original: default floating-point environment The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (宏不变) |
[编辑] 注释
浮点异常无关的C + +异常。当浮点运算提出了一个浮点异常,浮点环境的变化,可以测试std::fetestexcept的状态,但在大多数实现中的C + +程序不间断地继续执行.
Original:
The floating-point exceptions are not related to the C++ exceptions. When a floating-point operation raises a floating-point exception, the status of the floating-point environment changes, which can be tested with std::fetestexcept, but the execution of a C++ program on most implementations continues uninterrupted.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
有编译器的扩展,可用于自动生成C + +异常的浮点异常时,提出:1
Original:
There are compiler extensions that may be used to generate C++ exceptions automatically whenever a floating-point exception is raised:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- GNU libc函数
feenableexcept()可捕获浮点异常,产生的信号SIGFPE。如果-fnon-call-exceptions使用的编译器选项,信号的处理程序,可能会引发用户定义的C + +异常.Original:GNU libc functionfeenableexcept()enables trapping of the floating-point exceptions, which generates the signalSIGFPE. If the compiler option-fnon-call-exceptionswas used, the handler for that signal may throw a user-defined C++ exception.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - 微软的WinAPI函数
_control87()可捕获浮点异常,产生一个硬件异常,这可以被转换成C + +异常_set_se_translator.Original:Microsoft WinAPI function_control87()enables trapping of the floating-point exceptions, which generates a hardware exception, which can be converted to C++ exceptions with_set_se_translator.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.