isgreater
, isgreaterequal
, isless
, islessequal
, islessgreater
, isunordered
決定兩個浮點值之間的排序關聯性。
語法
int isgreater(
/* floating-point */ x,
/* floating-point */ y
); /* C-only macro */
int isgreaterequal(
/* floating-point */ x,
/* floating-point */ y
); /* C-only macro */
int isless(
/* floating-point */ x,
/* floating-point */ y
); /* C-only macro */
int islessequal(
/* floating-point */ x,
/* floating-point */ y
); /* C-only macro */
int islessgreater(
/* floating-point */ x,
/* floating-point */ y
); /* C-only macro */
int isunordered(
/* floating-point */ x,
/* floating-point */ y
); /* C-only macro */
template <class FloatingType1, class FloatingType2>
inline bool isgreater(
FloatingType1 x,
FloatingType2 y
) throw(); /* C++-only template function */
template <class FloatingType1, class FloatingType2>
inline bool isgreaterequal(
FloatingType1 x,
FloatingType2 y
) throw(); /* C++-only template function */
template <class FloatingType1, class FloatingType2>
inline bool isless(
FloatingType1 x,
FloatingType2 y
) throw(); /* C++-only template function */
template <class FloatingType1, class FloatingType2>
inline bool islessequal(
FloatingType1 x,
FloatingType2 y
) throw(); /* C++-only template function */
template <class FloatingType1, class FloatingType2>
inline bool islessgreater(
FloatingType1 x,
FloatingType2 y
) throw(); /* C++-only template function */
template <class FloatingType1, class FloatingType2>
inline bool isunordered(
FloatingType1 x,
FloatingType2 y
) throw(); /* C++-only template function */
參數
x
, y
要比較的浮點值。
傳回值
在所有比較中,相同符號的不完全比較為相等。 負無限大小於任何有限值或正無限大。 正無限大大於任何有限值或負無限大。 不論符號為何,零都相等。 NaN 不小於、等於或大於任何值,包括另一個 NaN。
當兩個引數都不是 NaN 時,如果 和 y
之間的指定排序關聯性為 true,則排序宏 isgreater
、 isgreaterequal
、 isless
和 islessequal
會傳回非零 x
值。 如果或兩個引數都是 NaN,或排序關聯性為 false,則這些宏會傳回 0。 函式表單的行為方式相同,但會傳回 true
或 false
。
如果 x
和 y
都不是 NaN,而且 x
小於或大於 y
,宏 islessgreater
會傳回非零值。 如果任一或兩個引數都是 NaN,或值相等,則會傳回 0。 函式表單的行為方式相同,但會傳 true
回 或 false
。
如果 x
、 y
或兩者都是 NaN,宏 isunordered
會傳回非零值。 否則,它會傳回 0。 函式表單的行為方式相同,但會傳 true
回 或 false
。
備註
這些比較作業會在編譯為 C 時實作為宏,並在編譯為 C++ 時實作為內嵌範本函式。
需求
函式 | 必要的標頭 (C) | 必要的標頭 (C++) |
---|---|---|
isgreater , isgreaterequal , isless ,islessequal , islessgreater , isunordered |
<math.h> | <math.h > 或 < cmath> |
如需相容性詳細資訊,請參閱相容性。
另請參閱
數學和浮點支援
isfinite
, _finite
, _finitef
isinf
isnan
, _isnan
, _isnanf
_fpclass
, _fpclassf
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應