std::islessgreater
来自 cppreference.cn
定义于头文件 <cmath> |
||
(1) | ||
bool islessgreater( float x, float y ); bool islessgreater( double x, double y ); |
(since C++11) (until C++23) |
|
constexpr bool islessgreater( /* floating-point-type */ x, /* floating-point-type */ y ); |
(since C++23) | |
定义于头文件 <cmath> |
||
template< class Arithmetic1, class Arithmetic2 > bool islessgreater( Arithmetic1 x, Arithmetic2 y ); |
(A) | (since C++11) (constexpr since C++23) |
1) 确定浮点数 x 是否小于或大于浮点数 y,而不设置浮点异常。该库为所有 cv 限定的浮点类型提供重载作为参数 x 和 y 的类型。 The library provides overloads for all cv-unqualified floating-point types as the type of the parameters x and y.(since C++23)
A) 为所有其他算术类型的组合提供了额外的重载。
内容 |
[edit] 参数
x, y | - | 浮点值或整数值 |
[edit] 返回值
true 如果 x < y || x > y, false 否则。
[edit] 注释
内置的浮点数运算符operator< 和 operator> 在其中一个或两个参数为 NaN 时可能会引发 FE_INVALID。此函数是表达式 x < y || x > y 的“安静”版本。
额外的重载不需要完全按照 (A) 的形式提供。它们只需要足以确保对于它们的第一个参数 num1 和第二个参数 num2
|
(until C++23) |
如果 num1 和 num2 具有算术类型,则 std::islessgreater(num1, num2) 具有与 std::islessgreater(static_cast</*common-floating-point-type*/>(num1), 如果不存在具有最高等级和子等级的此类浮点类型,则重载解析不会从提供的重载中产生可用的候选项。 |
(since C++23) |
[edit] 参见
(C++11) |
检查第一个浮点参数是否小于第二个 (函数) |
(C++11) |
检查第一个浮点参数是否大于第二个 (函数) |
C 文档 for islessgreater
|