C <math.h> - isnormal()
The C <math.h> isnormal() macro returns true if the given argument is a normal value, else returns false. A normal value is any floating-point value that is neither infinity, NaN, zero or subnormal.
Syntax
isnormal(x)
Parameters
x |
Specify a floating-point value. |
Return Value
Returns true (non-zero value) if the argument is an infinity value, else returns false (zero value).
Example:
The example below shows the usage of isnormal() macro.
#include <stdio.h> #include <math.h> int main (){ printf("isnormal(10.5): %d\n", isnormal(10.5)); printf("isnormal(1.0/0.0): %d\n", isnormal(1.0/0.0)); printf("isnormal(0.0/0.0): %d\n", isnormal(0.0/0.0)); printf("isnormal(sqrt(-1.0)): %d\n", isnormal(sqrt(-1.0))); return 0; }
The output of the above code will be:
isnormal(10.5): 1 isnormal(1.0/0.0): 0 isnormal(0.0/0.0): 0 isnormal(sqrt(-1.0)): 0
❮ C <math.h> Library