MATH_ERRNO, MATH_ERREXCEPT, math_errhandling
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <cmath> 中定义
|
||
#define MATH_ERRNO 1 |
(C++11 起) | |
#define MATH_ERREXCEPT 2 |
(C++11 起) | |
#define math_errhandling /*implementation defined*/ |
(C++11 起) | |
宏恒定
math_errhandling
扩展到表达类型int是等于MATH_ERRNO
,或等于MATH_ERREXCEPT
,或等于其按位OR(MATH_ERRNO | MATH_ERREXCEPT)的.原文:
The macro constant
math_errhandling
expands to an expression of type int that is either equal to MATH_ERRNO
, or equal to MATH_ERREXCEPT
, or equal to their bitwise OR (MATH_ERRNO | MATH_ERREXCEPT).的值
math_errhandling
表示通过浮点运算符和函数执行的错误处理的类型是:原文:
The value of
math_errhandling
indicates the type of error handling that is performed by the floating-point operators and functions: 常数
|
Explanation |
MATH_ERREXCEPT
|
表明,使用浮点异常:至少FE_DIVBYZERO,FE_INVALID,FE_OVERFLOW中定义的<cfenv>.
原文: indicates that floating-point exceptions are used: at least FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW are defined in <cfenv>. |
MATH_ERRNO
|
表示浮点操作使用变量errno报告错误.
原文: indicates that floating-point operations use the variable errno to report errors. |
以下浮点错误条件的,确认
原文:
The following floating-point error conditions are recognized:
本章尚未完成 原因:needs to be a table |
#域误差(输入参数是在数学上定义的操作范围之外的,例如std::sqrt(-1),std::log(-1)或std::acos(2))。如果
MATH_ERRNO
位被置位,EDOM分配errno。如果MATH_ERREXCEPT位被置位,FE_INVALID提高.范围错误(数学计算结果不能表示指定类型的对象,例如std::atanh(-1),std::log(0.0),或std::lgamma(0.0))。如果MATH_ERRNO位被置位,ERANGE分配errno。 MATH_ERREXCEPT位被置位,FE_DIVBYZERO或FE_OVERFLOW提高.
原文:
# Range error (the mathematical result cannot be represented as the object of specified type, e.g. std::atanh(-1), std::log(0.0), or std::lgamma(0.0)). If MATH_ERRNO bit is set, ERANGE is assigned to errno. If MATH_ERREXCEPT bit is set, FE_DIVBYZERO or FE_OVERFLOW is raised.
#溢出(数学结果是有限的,但过大而无法代表没有极端的舍入误差,如std::exp功能,如具有足够大的参数)。如果MATH_ERRNO位被置位,ERANGE分配errno。如果MATH_ERREXCEPT位被置位,FE_OVERFLOW提高.
原文:
# Overflow (the mathematical result is finite, but too big to be represented without extreme roundoff error, e.g. functions such as std::exp with sufficiently large arguments). If MATH_ERRNO bit is set, ERANGE is assigned to errno. If MATH_ERREXCEPT bit is set, FE_OVERFLOW is raised.
:#下溢(数学结果是不为零,但太小,被表示没有极端的舍入误差,例如,其结果是低于正常std::sin(subnormal)或许多其他函数低于正常论据)。如果MATH_ERRNO位被置位,可以被分配给ERANGEerrno。如果MATH_ERREXCEPT位被置位,FE_UNDERFLOW可以提高.
原文:
# Underflow (the mathematical result is non-zero, but too small to be represented without extreme roundoff error, e.g. the result is subnormal, as in std::sin(subnormal) or for many other functions with subnormal arguments). If MATH_ERRNO bit is set, ERANGE may be assigned to errno. If MATH_ERREXCEPT bit is set, FE_UNDERFLOW may be raised.
[编辑] 示例
本章尚未完成 原因:暂无示例 |
[编辑] 另请参阅
浮点异常 (常量宏) | |
宏扩展到本地POSIX兼容线程错误号variable
(宏变量) 原文: macro which expands to POSIX-compatible thread-local error number variable (宏变量) |