isgreater
来自cppreference.com
在标头 <math.h> 定义 | ||
#define isgreater(x, y) /* 由实现定义 */ | (C99 起) | |
确定浮点数 x 是否大于浮点数 y,而不设置浮点数异常。
目录 |
[编辑]参数
x | - | 浮点数 |
y | - | 浮点数 |
[编辑]返回值
若 x > y 则为非零整数,否则为 0。
[编辑]注解
若一或两个参数为 NaN,则内建的 operator> 对浮点数可能引发 FE_INVALID。此宏是 operator> 的“安静”版本。
[编辑]示例
运行此代码
可能的输出:
isgreater(2.0,1.0) = 1 isgreater(1.0,2.0) = 0 isgreater(INFINITY,1.0) = 1 isgreater(1.0,NAN) = 0
[编辑]引用
- C23 标准(ISO/IEC 9899:2024):
- 7.12.14.1 The isgreater macro (第 TBD 页)
- F.10.11 Comparison macros (第 TBD 页)
- C17 标准(ISO/IEC 9899:2018):
- 7.12.14.1 The isgreater macro (第 189 页)
- F.10.11 Comparison macros (第 386-387 页)
- C11 标准(ISO/IEC 9899:2011):
- 7.12.14.1 The isgreater macro (第 259 页)
- F.10.11 Comparison macros (第 531 页)
- C99 标准(ISO/IEC 9899:1999):
- 7.12.14.1 The isgreater macro (第 240 页)
[编辑]参阅
(C99) | 检查第一个浮点数实参是否小于第二个 (宏函数) |
isgreater 的 C++ 文档 |