"cpp nan value" Code Answer's
You're definitely familiar with the best coding language C++ that developers use to develop their projects and they get all their queries like "cpp nan value" answered properly. Developers are finding an appropriate answer about cpp nan value related to the C++ coding language. By visiting this online portal developers get answers concerning C++ codes question like cpp nan value. Enter your desired code related query in the search bar and get every piece of information about C++ code related question on cpp nan value.
cpp nan value
What is NaN ?
NaN, acronym for “Not a Number” is an exception
which usually occurs in the caseswhen an expression
results in a number that can’t be represented.
For example square root of negative numbers.
// C++ code to demonstrate NaN exception
#include<iostream>
#include<cmath> // for sqrt()
using namespace std;
int main()
{
float a = 2, b = -2;
// Prints the number (1.41421)
cout << sqrt(a) << endl;
// Prints "nan" exception
// sqrt(-2) is complex number
cout << sqrt(b) << endl;
return 0;
}
Output:
1.41421
-nan
All those coders who are working on the C++ based application and are stuck on cpp nan value can get a collection of related answers to their query. Programmers need to enter their query on cpp nan value related to C++ code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about cpp nan value for the programmers working on C++ code while coding their module. Coders are also allowed to rectify already present answers of cpp nan value while working on the C++ language code. Developers can add up suggestions if they deem fit any other answer relating to "cpp nan value". Visit this developer's friendly online web community, CodeProZone, and get your queries like cpp nan value resolved professionally and stay updated to the latest C++ updates.