![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
isunordered() function in C++
In this article we are going to discuss the isunordered() function in C++, its syntax, working and its return values.
isunordered() function is an inbuilt function in C++ which is defined in header file. The function checks whether the two floating points number be NAN, if both or either one of them is NAN then it will return 1(true) else will return 0(false).
Syntax
bool isunordered(float n1, float n2);
or
bool isunordered(double n1, double n2);
or
bool isunordered(long double n1, long double n2);
The function accepts two floating point variables to compare and check if either one of these is nan.
Return value
The function return the boolean value i.e., 1 for true and 0 for false.
Example
#include <iostream> #include <cmath> using namespace std; int main() { float a = -1.0; float c = sqrt(-1.0); cout<<c; //printing the result of c cout<<"\n"<<isunordered(c, 0.0); //will check if either of them is nan }
Output
If we run the above code it will generate the following output −
-nan 1
Example
#include <iostream> #include <cmath> using namespace std; int main() { cout<<isunordered(0.0, -1.0); }
Output
If we run the above code it will generate the following output −
0
Advertisements