isgreater
來自 cppreference.com
定義於標頭檔案 <math.h> |
||
#define isgreater(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("isgreater(2.0,1.0) = %d\n", isgreater(2.0, 1.0)); printf("isgreater(1.0,2.0) = %d\n", isgreater(1.0, 2.0)); printf("isgreater(INFINITY,1.0) = %d\n", isgreater(INFINITY, 1.0)); printf("isgreater(1.0,NAN) = %d\n", isgreater(1.0, NAN)); return 0; }
可能的輸出
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 isgreater 宏 (p: 待定)
- F.10.11 比較宏 (p: TBD)
- C17 標準 (ISO/IEC 9899:2018)
- 7.12.14.1 isgreater 宏 (p: 189)
- F.10.11 比較宏 (p: 386-387)
- C11 標準 (ISO/IEC 9899:2011)
- 7.12.14.1 isgreater 宏 (p: 259)
- F.10.11 比較宏 (p: 531)
- C99 標準 (ISO/IEC 9899:1999)
- 7.12.14.1 isgreater 宏 (p: 240)
[編輯] 另請參閱
(C99) |
檢查第一個浮點引數是否小於第二個 (函式宏) |
C++ documentation for isgreater
|