Normal Number
A number is called a normal number if it is neither infinite, zero, nor NAN.
For example, the number 5 is a normal number, while 0 is not a normal number.
Syntax:
bool isnormal(double x);
bool isnormal(float x);
bool isnormal(long double x);

You can also try this code with Online C++ Compiler
Run Code
Parameters:
Only one parameter of type float is accepted by the isnormal() function.
Return Value:
If the number provided is a normal number, then it returns 1. Else it returns 0.
Also Read - C++ Interview Questions
Example
// example of isnormal() function.
#include <bits/stdc++.h>
using namespace std;
int main()
{
float f = 1.0F;
// non-zero value
cout << "isnormal 1.0= " << isnormal(f) << endl;
// infinite value
f = 1.2F;
cout << "isnormal(1.2/0.0) is = " << isnormal(f / 0.0) << endl;
// zero
f = 0.0F;
cout << "isnormal 0.0= " << isnormal(f) << endl;
return 0;
}

You can also try this code with Online C++ Compiler
Run Code
Output:
isnormal 1.0= 1
isnormal(1.2/0.0) is = 0
isnormal 0.0= 0

You can also try this code with Online C++ Compiler
Run Code
Try and compile with online c++ compiler.
Frequently Asked Questions
What is C++ programming language?
C++ is a programming language that may be used to write both imperative and object-oriented code. It is a middle-level programming language. It's a compiled, general-purpose, statically typed, case-sensitive, free-form programming language.
What are normal numbers?
A number is called a normal number if it is neither infinite, zero, nor NAN.
For example, the number 5 is a normal number, while 0 is not a normal number.
What does isnormal() function in C++ does?
isnormal() is an inbuilt function in C++ programming language which is defined under the <cmath.h> header. This function is used to verify whether a given number is normal or not.
Conclusion
In this article, we have extensively discussed the about isnormal() function along with examples in C++ programming language. We hope that this blog has helped you enhance your knowledge regarding isnormal function in C++ programming language and if you would like to learn more about the C++ programming language, check out this article on Basics of C++. You can refer to our guided paths on the Coding Ninjas Studio platform to learn more about important languages and core concepts. To practice and improve yourself in the interview, you can check out Top 100 SQL problems, Interview experience, Coding interview questions, and the Ultimate guide path for interviews. Do upvote our blog to help other ninjas grow.
Happy Coding!