Single - IsInfinity
Returns a value indicating whether the specified number evaluates to negative or positive infinity.
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); }
View Source
using System; public static partial class Extensions { /// <summary> /// Returns a value indicating whether the specified number evaluates to negative or positive infinity. /// </summary> /// <param name="f">A single-precision floating-point number.</param> /// <returns>true if evaluates to or ; otherwise, false.</returns> public static Boolean IsInfinity(this Single f) { return Single.IsInfinity(f); } }