| macro | isnan(x) |
|---|
| function | bool isnan (float x);bool isnan (double x);bool isnan (long double x); |
|---|
int value. The type of x shall be float, double or long double.bool value.true) if x is a NaN value; and zero (false) otherwise.1
2
3
4
5
6
7
8
9
10
11
12
/* isnan example */
#include <stdio.h> /* printf */
#include <math.h> /* isnan, sqrt */
int main()
{
printf ("isnan(0.0) : %d\n",isnan(0.0));
printf ("isnan(1.0/0.0) : %d\n",isnan(1.0/0.0));
printf ("isnan(-1.0/0.0) : %d\n",isnan(-1.0/0.0));
printf ("isnan(sqrt(-1.0)): %d\n",isnan(sqrt(-1.0)));
return 0;
}
isnan(0.0) : 0 isnan(1.0/0.0) : 0 isnan(-1.0/0.0) : 0 isnan(sqrt(-1.0)): 1