Double.IsFinite() Method in C#
Double.IsFinite() Method is used to check whether the double value is out of bound or not.
Syntax: public static bool IsFinite (double value);
Return Value: This method returns the true if value is finite otherwise false.
Below programs illustrate the use of Double.IsFinite() Method:
Example 1:
using System;
using System.Globalization;
class GFG {
public static void Main()
{
double value1 = 10d;
bool value = Double.IsFinite(value1);
if (value)
Console.WriteLine( "{0} is finite" , value1);
else
Console.WriteLine( "{0} is not finite" , value1);
}
}
|
Example 2:
using System;
using System.Globalization;
class GFG {
public static void Main()
{
double value1 = Math.Pow(2, 1000000000000);
bool value = Double.IsFinite(value1);
if (value)
Console.WriteLine( "{0} is finite" , value1);
else
Console.WriteLine( "{0} is not finite" , value1);
}
}
|
Output:
Infinity is not finite
Last Updated :
15 Apr, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...