C# Extension Method: Single - IsInfinity

CSharp · Console

/Program.cs

// C# Extension Method
// Doc: https://csharp-extension.com/en/method/1002592/single-isinfinity

// @nuget: Z.ExtensionMethods

using System;
					
public class Program
{
    public static void Main()
    {

        Console.WriteLine("It returns a value indicating whether the specified number evaluates to negative or positive infinity.\n");

        Display(32.0f, 12);
		Display(32.0f, 0);
		Display(-5f, 0);
		Display(0.0f, 0);
    }
	
	public static void Display(float f1, float f2)
	{
		// C# Extension Method: Single - IsInfinity
        bool result = (f1 / f2).IsInfinity();

        Console.WriteLine("{0}/{1} = {2}", f1, f2, result);
	}
}
;