std:: feholdexcept
From cppreference.net
C++
Numerics library
| Common mathematical functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Mathematical special functions (C++17) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Mathematical constants (C++20) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Basic linear algebra algorithms (C++26) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Data-parallel types (SIMD) (C++26) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Floating-point environment (C++11) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Complex numbers | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Numeric array (
valarray
)
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Pseudo-random number generation | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Bit manipulation (C++20) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Saturation arithmetic (C++26) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Factor operations | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Interpolations | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Generic numeric operations | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| C-style checked integer arithmetic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Floating-point environment
| Functions | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
(C++11)
|
||||
|
(C++11)
(C++11)
|
||||
|
(C++11)
(C++11)
|
||||
|
feholdexcept
(C++11)
|
||||
|
(C++11)
|
||||
| Macro constants | ||||
|
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
|
||||
|
(C++11)
(C++11)
(C++11)
(C++11)
|
||||
|
(C++11)
|
|
定义于头文件
<cfenv>
|
||
|
int
feholdexcept
(
std::
fenv_t
*
envp
)
|
(C++11 起) | |
首先,将当前浮点环境保存到
envp
所指向的对象(类似于
std::fegetenv
),然后清除所有浮点状态标志,接着安装非停止模式:在通过
std::feupdateenv
或
std::fesetenv
恢复浮点环境之前,未来的浮点异常将不会中断执行(不会陷入陷阱)。
此函数可用于子程序开头,该子程序必须隐藏可能引发的浮点异常,避免被调用方感知。若只需抑制部分异常而仍需报告其他异常,通常在清除不需要的异常后,通过调用 std::feupdateenv 来结束非停止模式。
参数
| envp | - | 指向 std:: fenv_t 类型对象的指针,浮点环境将被存储到该对象中 |
返回值
0 表示成功,非零值表示失败。
参见
|
(C++11)
|
恢复浮点环境并触发先前引发的异常
(函数) |
|
(C++11)
|
保存或恢复当前浮点环境
(函数) |
|
(C++11)
|
默认浮点环境
(宏常量) |
|
C 文档
for
feholdexcept
|
|