isgreaterequal
来自 cppreference.cn
定义于头文件 <math.h> |
||
#define isgreaterequal(x, y) /* implementation defined */ |
(C99 起) | |
确定浮点数 x 是否大于或等于浮点数 y,而不会设置浮点异常。
目录 |
[编辑] 参数
x | - | 浮点值 |
y | - | 浮点值 |
[编辑] 返回值
如果 x >= y,则返回非零整数值,否则返回 0。
[编辑] 注意
浮点数的内置 operator>= 可能会在其中一个或两个参数为 NaN 时引发 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 isgreaterequal 宏 (p: TBD)
- F.10.11 比较宏 (p: TBD)
- C17 标准 (ISO/IEC 9899:2018)
- 7.12.14.2 isgreaterequal 宏 (p: TBD)
- F.10.11 比较宏 (p: TBD)
- C11 标准 (ISO/IEC 9899:2011)
- 7.12.14.2 isgreaterequal 宏 (p: 259-260)
- F.10.11 比较宏 (p: 531)
- C99 标准 (ISO/IEC 9899:1999)
- 7.12.14.2 isgreaterequal 宏 (p: 240-241)
[编辑] 参见
(C99) |
检查第一个浮点参数是否小于或等于第二个 (函数宏) |
C++ 文档 中关于 isgreaterequal
|