
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
isnormal in C++
In this section we will see the isnormal() function in C++. This function is present in the cmath library. This function is used to check whether a number is normal or not. The numbers that are considered as non-normal are zeros, infinity or NAN.
This function takes float, double or long double values as argument. Returns 1 if the number is normal, otherwise returns 0.
Example
#include<iostream> #include<cmath> using namespace std; int main() { cout << "isnormal(" << 5.23 << "): " << isnormal(5.23) << endl; cout << "isnormal(" << 0.00 << "): " << isnormal(0.00) << endl; cout << "isnormal(" << 2.0/0.0 << "): " << isnormal(2.0/0.0) << endl; }
Output
isnormal(5.23): 1 isnormal(0): 0 isnormal(inf): 0
Advertisements