Single.IsFinite() Method in C# with Examples
Single.IsFinite() Method is used to check whether the float value is out of bound or not.
Syntax: public static bool IsFinite (float value);
Return Value: This method returns the true if value is finite otherwise false.
Below programs illustrate the use of Single.IsFinite() Method:
Example 1:
// C# program to demonstrate the // Single.IsFinite() Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // Declaring and initializing value1 float value1 = 1654.268416f; // using IsFinite() method bool value = Single.IsFinite(value1); // Displaying the result if (value) Console.WriteLine("{0} is finite", value1); else Console.WriteLine("{0} is not finite", value1); } } |
chevron_right
filter_none
Output:
1654.268 is finite
Example 2:
// C# program to demonstrate the // Single.IsFinite() Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // Declaring and initializing value1 float value1 = (float)Math.Pow(2, 10000000); // using IsFinite() method bool value = Single.IsFinite(value1); // Displaying the result if (value) Console.WriteLine("{0} is finite", value1); else Console.WriteLine("{0} is not finite", value1); } } |
chevron_right
filter_none
Output:
Infinity is not finite
Reference:
Recommended Posts:
- MathF.Abs() Method in C# with Examples
- MathF.Tan() Method in C# with Examples
- MathF.Exp() Method in C# with Examples
- MathF.Cos() Method in C# with Examples
- MathF.Sin() Method in C# with Examples
- MathF.Max() Method in C# with Examples
- MathF.Min() Method in C# with Examples
- MathF.Log() Method in C# with Examples
- MathF.Pow() Method in C# with Examples
- MathF.Cosh() Method in C# with Examples
- MathF.Sinh() Method in C# with Examples
- MathF.Tanh() Method in C# with Examples
- Boolean.GetHashCode() Method in C# with Examples
- Boolean.GetTypeCode Method in C# with Examples
- Double.Equals() Method in C# with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. 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.



