C++ cmath isnormal function


The C++ cmath isnormal determines if the argument is normal.

bool isnormal(float x);
bool isnormal(double x);
bool isnormal(long double x);

Parameters:
x -A floating point value .

Return type
bool-Return true if the parameter is normal,it should not be 0,nan,infinity and subnormal.

The function returns true only if it is floating point value or convertible to floating point type-an int or char type.If the parameter is string you get an error.

Code example

/*Passing floating point value*/
cout<< isnormal(23) << endl;

/*Passing NAN,INFINITY and 0*/
cout<< isnormal(NAN) << endl
<< isnormal(INFINITY) << endl
<< isnormal(0) << endl ;

/*Passing string 0*/
cout<< isnormal(“a string”) ; ///error

Output

1
0
0
0