VOOZH about

URL: https://www.geeksforgeeks.org/cpp/isnormal-in-c/

⇱ isnormal() in C++ - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

isnormal() in C++

Last Updated : 26 Jun, 2023

This function is defined in <cmath.h> . By using isnormal() function, we determines that whether the given number is normal (neither zero, infinite nor NAN) or not. This function returns 1 if the number is normal else return zero. 

Syntax:

bool isnormal(float x);

or

bool isnormal(double x); 

or

bool isnormal(long double x); 

Parameters: This functions takes a mandatory parameter x which represents the floating point value. 

Returns: If the given value is normal then the function returns 1 otherwise the function returns zero.

Time Complexity: O(1)
Auxiliary Space: O(1)

Below program illustrate the isnormal() function in C++: 

Example 1:- To show with float value 

Output:
isnormal(7.0) is = 1
isnormal(0.0) is = 0
isnormal(9.2/0.0) is = 0

Example 2:- To show with double value 

Output:
isnormal(7.0) is = 1
isnormal(0.0) is = 0
isnormal(9.2/0.0) is = 0

Example 3:- To show with long double value 

Output:
isnormal(7.0) is = 1
isnormal(0.0) is = 0
isnormal(9.2/0.0) is = 0
Comment
Article Tags: