?
This document uses PHP Chinese website manual Release
在頭文件<stdlib.h>中定義 | ||
---|---|---|
#define isunordered(x, y) /* implementation defined */ | (since C99) |
確定該浮點數(shù)x
和y
是無序的,即,一個或兩個都為NaN,因此不能得到有意義的相互比較。
x | - | 浮點值 |
---|---|---|
y | - | 浮點值 |
非零的整數(shù)值,如果是x
或者y
是NaN,0
否則。
#include <stdio.h>#include <math.h> int main(void){ printf("isunordered(NAN,1.0) = %d\n", isunordered(NAN,1.0)); printf("isunordered(1.0,NAN) = %d\n", isunordered(1.0,NAN)); printf("isunordered(NAN,NAN) = %d\n", isunordered(NAN,NAN)); printf("isunordered(1.0,0.0) = %d\n", isunordered(1.0,0.0)); return 0;}
可能的輸出:
isunordered(NAN,1.0) = 1isunordered(1.0,NAN) = 1isunordered(NAN,NAN) = 1isunordered(1.0,0.0) = 0
C11標(biāo)準(zhǔn)(ISO / IEC 9899:2011):
7.12.14.6無序宏(p:261)
F.10.11比較宏(p:531)
C99標(biāo)準(zhǔn)(ISO / IEC 9899:1999):
7.12.14.6無序宏(p:242)