cpp nan value
C++
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
Also in C++:
- Title
- c++ excel cell blank cells
- Category
- C++
- Title
- google pdf iframe viwer
- Category
- C++
- Title
- new class * [] c++
- Category
- C++
- Title
- how to iterate through a map in c++
- Category
- C++
- Title
- find all occurrences of a substring in a string c++
- Category
- C++
- Title
- Shortest Distance in a Maze
- Category
- C++
- Title
- arrow operator c++
- Category
- C++
- Title
- minmax_element c++
- Category
- C++
- Title
- graph using djacency matrix c++
- Category
- C++
- Title
- sort function in vector c++ stl
- Category
- C++
- Title
- initialize array c++
- Category
- C++
- Title
- invalid types int int for array subscript c++
- Category
- C++
- Title
- stoi c++
- Category
- C++
- Title
- how to put a class in a .h file c++
- Category
- C++
- Title
- c++ map insert
- Category
- C++
- Title
- lopping over an array c++
- Category
- C++
- Title
- iterate 2d array c++
- Category
- C++
- Title
- c++ enum rand
- Category
- C++
- Title
- __builtin_ctz
- Category
- C++
- Title
- array as parameter c++
- Category
- C++
- Title
- font awesome bootstrap cdn
- Category
- C++
- Title
- basic ex of maps in c++
- Category
- C++
- Title
- add a timer c++
- Category
- C++
- Title
- c++ do you not inherit constructor
- Category
- C++
- Title
- how to import getline in c++
- Category
- C++
- Title
- c++ calculator program using switch case
- Category
- C++
- Title
- reference function in c++
- Category
- C++
- Title
- how to hide ui elements unity
- Category
- C++
- Title
- centos7 mlock2
- Category
- C++
- Title
- what is atoi in strinf
- Category
- C++
- Title
- c++ program for matrix addition
- Category
- C++
- Title
- c++ evaluate expression
- Category
- C++
- Title
- std::substring
- Category
- C++
- Title
- monotonic deque
- Category
- C++
- Title
- c++ modulo make it give only positive numbers
- Category
- C++
- Title
- initialize 2d array c++
- Category
- C++
- Title
- c++ vector
- Category
- C++
- Title
- mao two drivers c++
- Category
- C++
- Title
- pbds in c++
- Category
- C++
- Title
- find_if c++ example
- Category
- C++
- Title
- double to float c++
- Category
- C++
- Title
- memcmp in cpp
- Category
- C++
- Title
- initialize vector of pointers c++
- Category
- C++
- Title
- how to append to a vector c++
- Category
- C++
- Title
- Get handle in C++
- Category
- C++
- Title
- what is a header in c++
- Category
- C++
- Title
- loop through words in string c++
- Category
- C++
- Title
- error: invalid use of template-name without an argument list
- Category
- C++
- Title
- can you use a return to print a string when referencing an integer c++
- Category
- C++
- Title
- initialization list c++
- Category
- C++
- Title
- how are graphics in games made
- Category
- C++
- Title
- how to append two vectors in c++
- Category
- C++
- Title
- how to extract substring from string in c++
- Category
- C++
- Title
- how to make a n*n 2d dynamic array in c++
- Category
- C++
- Title
- c++ comment
- Category
- C++
- Title
- size of a matrix c++
- Category
- C++
- Title
- how to get a letter from the user c++ string
- Category
- C++
- Title
- simple timer arduino blynk library error
- Category
- C++
- Title
- c++ give options string
- Category
- C++
- Title
- c++ declare variable
- Category
- C++
- Title
- C++ sfinae
- Category
- C++
- Title
- correct sequence of compilation process in c++
- Category
- C++
- Title
- how to print to the serial monitor arduino
- Category
- C++
- Title
- conditional operator in cpp
- Category
- C++
- Title
- compare values within within a vector c++
- Category
- C++
- Title
- qt graphics scene map cursor position
- Category
- C++
- Title
- find upper bound c++ vector
- Category
- C++
- Title
- c++ pi
- Category
- C++
- Title
- c++ char define
- Category
- C++
- Title
- how to delete an element in vector pair in cpp
- Category
- C++
- Title
- find in vector in c++
- Category
- C++
- Title
- c++ code 2d block
- Category
- C++
- Title
- % operator in c++
- Category
- C++
- Title
- generate random double c++
- Category
- C++
- Title
- hashmap in c++
- Category
- C++
- Title
- calling a method on an object c++
- Category
- C++
- Title
- iostream library in cpp
- Category
- C++
- Title
- pow c++
- Category
- C++
- Title
- c++ return multiple values
- Category
- C++
- Title
- new keyword in cpp
- Category
- C++
- Title
- how to have a queue as a parameter in c++
- Category
- C++
- Title
- char to string c++
- Category
- C++
- Title
- preorder traversal c++
- Category
- C++
- Title
- c++ program to input and print text using Dynamic Memory Allocation.loop
- Category
- C++
- Title
- what are the different ways to traverse a binary tree
- Category
- C++
- Title
- how to declare a vector in c++
- Category
- C++
- Title
- c++ declare char
- Category
- C++
- Title
- c++ typeid get type name
- Category
- C++
- Title
- ue4 c++ struct
- Category
- C++
- Title
- char* to int in cpp
- Category
- C++
- Title
- c++ give options
- Category
- C++
- Title
- c++ multidimensional vector
- Category
- C++
- Title
- subarray sum in c++
- Category
- C++
- Title
- c++ cli convert string to string^
- Category
- C++
- Title
- if esle in c++
- Category
- C++
- Title
- rgb(100,100,100,0.5) validation c++
- Category
- C++
- Title
- log base 10 c+_+
- Category
- C++
- Title
- convert stirng to int c++
- Category
- C++
- Title
- how to reverse a vector
- Category
- C++
- Title
- c++ stream string into fiel
- Category
- C++