C++ Math isnormal
The function determines that whether the given number is normal or not. If the number is normal, it returns 1 otherwise 0.
Syntax
Suppose a number is 'x'. Syntax would be:
Example
bool isnormal(float x);
bool isnormal(double x);
bool isnormal(long double x);
bool isnormal(integral x);
Parameter
x : It is a floating point value.
Return value
| Parameter(x) | Return value |
|---|---|
| Infinite | 0 |
| Normal value | 1 |
| Subnormal value | 0 |
| Not a Number | 0 |
Example 1
Let's see the simple example.
Example
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
std::cout << "isnormal(5) is : " <<isnormal(5)<< std::endl;
std::cout << "isnormal(5.0/0.0) is : " <<isnormal(5.0/0.0)<< std::endl;
std::cout << "isnormal(0.0/0.0) is : " <<isnormal(0.0/0.0)<< std::endl;
return 0;
}
Output:
Output
isnormal(5) is : 1
isnormal(5.0/0.0) is : 0
isnormal(0.0/0.0) is : 0