Open In App

Double.IsFinite() Method in C#

Last Updated : 15 Apr, 2019
Summarize
Comments
Improve
Suggest changes
Share
Like Article
Like
Report
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: csharp
// C# program to demonstrate the
// Double.IsFinite() Method
using System;
using System.Globalization;

class GFG {

    // Main Method
    public static void Main()
    {
        // Declaring and initializing value1
        double value1 = 10d;

        // using IsFinite() method
        bool value = Double.IsFinite(value1);

        // Displaying the result
        if (value)
            Console.WriteLine("{0} is finite", value1);
        else
            Console.WriteLine("{0} is not finite", value1);
    }
}
Output:
10 is finite
Example 2: csharp
// C# program to demonstrate the
// Double.IsFinite() Method
using System;
using System.Globalization;

class GFG {

    // Main Method
    public static void Main()
    {
        // Declaring and initializing value1
        double value1 = Math.Pow(2, 1000000000000);

        // using IsFinite() method
        bool value = Double.IsFinite(value1);

        // Displaying the result
        if (value)
            Console.WriteLine("{0} is finite", value1);
        else
            Console.WriteLine("{0} is not finite", value1);
    }
}
Output:
Infinity is not finite

Next Article

Similar Reads