isgreaterequal
来自cppreference.com
| 在标头 <math.h> 定义
|
||
| |
(C99 起) | |
确定浮点数 x 是否大于或等于浮点数 y,而不设置浮点数异常。
参数
| x | - | 浮点数 |
| y | - | 浮点数 |
返回值
若 x >= y 则为非零整数,否则为 0。
注解
若一或两个参数为 NaN,则内建的 operator>= 对浮点数可能引发 FE_INVALID。此宏是 operator>= 的“安静”版本。
示例
运行此代码
#include <math.h>
#include <stdio.h>
int main(void)
{
printf("isgreaterequal(2.0,1.0) = %d\n", isgreaterequal(2.0, 1.0));
printf("isgreaterequal(1.0,2.0) = %d\n", isgreaterequal(1.0, 2.0));
printf("isgreaterequal(1.0,1.0) = %d\n", isgreaterequal(1.0, 1.0));
printf("isgreaterequal(INFINITY,1.0) = %d\n", isgreaterequal(INFINITY, 1.0));
printf("isgreaterequal(1.0,NAN) = %d\n", isgreaterequal(1.0, NAN));
return 0;
}
可能的输出:
isgreaterequal(2.0,1.0) = 1
isgreaterequal(1.0,2.0) = 0
isgreaterequal(1.0,1.0) = 1
isgreaterequal(INFINITY,1.0) = 1
isgreaterequal(1.0,NAN) = 0
引用
- C23 标准(ISO/IEC 9899:2024):
- 7.12.14.2 The isgreaterequal macro (第 TBD 页)
- F.10.11 Comparison macros (第 TBD 页)
- C17 标准(ISO/IEC 9899:2018):
- 7.12.14.2 The isgreaterequal macro (第 TBD 页)
- F.10.11 Comparison macros (第 TBD 页)
- C11 标准(ISO/IEC 9899:2011):
- 7.12.14.2 The isgreaterequal macro (第 259-260 页)
- F.10.11 Comparison macros (第 531 页)
- C99 标准(ISO/IEC 9899:1999):
- 7.12.14.2 The isgreaterequal macro (第 240-241 页)
参阅
(C99) |
检查第一个浮点数实参是否小于或等于第二个 (宏函数) |
isgreaterequal 的 C++ 文档
| |