©
This document uses PHP Chinese website manual Release
在头文件<stdlib.h>中定义 | ||
---|---|---|
#define isunordered(x, y) /* implementation defined */ | (since C99) |
确定该浮点数x
和y
是无序的,即,一个或两个都为NaN,因此不能得到有意义的相互比较。
x | - | 浮点值 |
---|---|---|
y | - | 浮点值 |
非零的整数值,如果是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标准(ISO / IEC 9899:2011):
7.12.14.6无序宏(p:261)
F.10.11比较宏(p:531)
C99标准(ISO / IEC 9899:1999):
7.12.14.6无序宏(p:242)