In C#, Double.IsInfinity() is a Double struct method. This method is used to check whether a specified value evaluates to either positive infinity or negative infinity or not. While performing some mathematical operations, it is possible to obtain a result that is either positive infinity or negative infinity. For Example: If any positive value is divided by zero, it results in positive infinity.
Syntax: public static bool IsInfinity (double d);
d: It is a double-precision floating-point number of type System.Double
Return Type: This function return a Boolean value True, if specified value evaluates to either positive infinity or negative infinity, otherwise return False.
Input : d = 10 / 0.0 Output : True Input : d = 7.997e307 + 9.985e307 Output : True
- If the result of any floating point operation exceeds Double.MaxValue (i.e 1.79769313486232E+308) is considered as Positive Infinity and if the result is less than Double.MinValue (i.e -1.79769313486232E+308) is considered as Negative Infinity.
- Floating-point operation return Infinity (Positive Infinity) or -Infinity (Negative Infinity) to indicate an overflow condition.
Code: To demonstrate the Double.IsInfinity(Double) Method
Infinity True Infinity True -Infinity True
- Difference between Method Overriding and Method Hiding in C#
- C# | Join() Method | Set - 1
- C# | Dictionary.Add() Method
- C# | PadLeft() Method
- DateTimeOffset.Add() Method in C#
- C# | Method Overloading
- C# | SortedDictionary.Add() Method
- C# | Method Overriding
- C# | ToLower() Method
- C# | ToUpper() Method
- C# | Copy() Method
- C# | Math.Pow() Method
- C# | PadRight() Method
- C# | Uri.IsHexEncoding() Method
- C# | CopyTo() Method
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.