In C#, Double.IsNaN() is a Double struct method. This method is used to check whether the specified value is not a number (NaN).
Syntax: public static bool IsNaN (double d);
d: It is a double-precision floating-point number of type System.Double
Return Type: This function returns a Boolean value i.e. True, if specified value is not a number(NaN), otherwise returns False.
Input : d = 0.0 / 0.0 Output : True Input : d = 1.734 Output : False
Code: To demonstrate the Double.IsNaN(Double) method.
Infinity is not NaN NaN is NaN
- If we divide any value by 0 directly, the Compiler will show an error. So, in the above example, 0 is stored in a variable first.
- Every floating point operation returns a NaN to show that the result of the operation is undefined.
- Difference between Method Overriding and Method Hiding in C#
- C# | ToUpper() Method
- C# | ToLower() Method
- C# | Uri.IsHexEncoding() Method
- DateTime.Add() Method in C#
- TimeSpan.Add() Method in C#
- C# | SortedDictionary.Add() Method
- C# | Copy() Method
- C# | CopyTo() Method
- C# | Trim() Method
- DateTimeOffset.Add() Method in C#
- Anonymous Method in C#
- C# | Method Overriding
- Stack.Contains() Method in C#
- Queue.Contains() Method in C#
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.