|
NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
|
浮点数特性检查和特殊值判断 更多...
函数 | |
| template<typename T> | |
| constexpr enable_if_t<!(sizeof(T)==16 &&numeric_traits< T >::digits==64), bool > | neforce::signbit (const T x) noexcept |
| 获取浮点数的符号位 | |
| template<typename T> | |
| constexpr bool | neforce::is_nan (const T x) noexcept |
| 检查浮点数是否为NaN | |
| template<typename T> | |
| constexpr bool | neforce::is_pos_infinity (const T x) noexcept |
| 检查浮点数是否为正无穷大 | |
| template<typename T> | |
| constexpr bool | neforce::is_neg_infinity (const T x) noexcept |
| 检查浮点数是否为负无穷大 | |
| template<typename T> | |
| constexpr bool | neforce::is_infinity (const T x) noexcept |
| 检查浮点数是否为无穷大 | |
| template<typename T> | |
| constexpr bool | neforce::is_finite (const T x) noexcept |
| 检查浮点数是否为有限值 | |
| template<typename T> | |
| constexpr bool | neforce::is_normal (const T x) noexcept |
| 检查浮点数是否为正规数 | |
| template<typename T> | |
| constexpr bool | neforce::is_subnormal (const T x) noexcept |
| 检查浮点数是否为次正规数 | |
| template<typename T> | |
| constexpr bool | neforce::is_positive (const T x) noexcept |
| 检查浮点数是否为正数 | |
| template<typename T> | |
| constexpr bool | neforce::is_negative (const T x) noexcept |
| 检查浮点数是否为负数 | |
浮点数特性检查和特殊值判断
|
constexprnoexcept |
检查浮点数是否为有限值
| T | 浮点数类型 |
| x | 待检查的浮点数 |
有限值包括:正常数、负零、正零、次正规数、正规数。
在文件 numeric_types.hpp 第 115 行定义.
引用了 is_finite(), is_infinity() , 以及 is_nan().
被这些函数引用 ceil(), floor(), is_finite(), is_normal(), is_subnormal(), round() , 以及 truncate().
|
constexprnoexcept |
检查浮点数是否为无穷大
| T | 浮点数类型 |
| x | 待检查的浮点数 |
在文件 numeric_types.hpp 第 102 行定义.
引用了 is_infinity(), is_neg_infinity() , 以及 is_pos_infinity().
被这些函数引用 arctangent(), cosine(), cube_root(), is_finite(), is_infinity(), logarithm_e(), mod(), remainder(), sine(), square_root() , 以及 tangent().
|
constexprnoexcept |
检查浮点数是否为NaN
| T | 浮点数类型 |
| x | 待检查的浮点数 |
NaN的特性:NaN != NaN 总是成立。
在文件 numeric_types.hpp 第 65 行定义.
引用了 is_floating_point_v , 以及 is_nan().
被这些函数引用 arccosine(), arcsine(), arctangent(), cosine(), cube_root(), is_finite(), is_nan(), logarithm_e(), mod(), remainder(), sine(), square_root() , 以及 tangent().
|
constexprnoexcept |
检查浮点数是否为负无穷大
| T | 浮点数类型 |
| x | 待检查的浮点数 |
在文件 numeric_types.hpp 第 89 行定义.
引用了 neforce::numeric_traits< T, Dummy >::infinity(), is_floating_point_v , 以及 is_neg_infinity().
被这些函数引用 is_infinity() , 以及 is_neg_infinity().
|
constexprnoexcept |
检查浮点数是否为负数
| T | 浮点数类型 |
| x | 待检查的浮点数 |
包括:负正规数、负次正规数、负无穷大、负零。
在文件 numeric_types.hpp 第 187 行定义.
引用了 is_negative() , 以及 signbit().
被这些函数引用 is_negative().
|
constexprnoexcept |
检查浮点数是否为正规数
| T | 浮点数类型 |
| x | 待检查的浮点数 |
正规数:绝对值大于等于最小正正规数的有限非零浮点数。 不包括:零、次正规数、无穷大、NaN。
在文件 numeric_types.hpp 第 129 行定义.
引用了 is_finite(), is_normal() , 以及 neforce::numeric_traits< T, Dummy >::min().
被这些函数引用 is_normal().
|
constexprnoexcept |
检查浮点数是否为正无穷大
| T | 浮点数类型 |
| x | 待检查的浮点数 |
在文件 numeric_types.hpp 第 77 行定义.
引用了 neforce::numeric_traits< T, Dummy >::infinity(), is_floating_point_v , 以及 is_pos_infinity().
被这些函数引用 is_infinity() , 以及 is_pos_infinity().
|
constexprnoexcept |
检查浮点数是否为正数
| T | 浮点数类型 |
| x | 待检查的浮点数 |
包括:正正规数、正次正规数、正无穷大、正零。
在文件 numeric_types.hpp 第 172 行定义.
引用了 is_positive() , 以及 signbit().
被这些函数引用 is_positive().
|
constexprnoexcept |
检查浮点数是否为次正规数
| T | 浮点数类型 |
| x | 待检查的浮点数 |
次正规数(非正规数):绝对值小于最小正正规数的非零浮点数。 用于表示接近零的非常小的数值。
在文件 numeric_types.hpp 第 150 行定义.
引用了 is_finite() , 以及 is_subnormal().
被这些函数引用 is_subnormal().
|
constexprnoexcept |
获取浮点数的符号位
| T | 浮点数类型 |
| x | 待检查的浮点数 |
通过检查浮点数的二进制表示中的符号位来判断其符号。
在文件 numeric_types.hpp 第 34 行定义.
引用了 is_floating_point_v , 以及 signbit().
被这些函数引用 is_negative(), is_positive() , 以及 signbit().