C# Single IsInfinity
Description
Single IsInfinity
returns a value indicating whether
the specified number evaluates to negative or positive infinity.
Syntax
Single.IsInfinity
has the following syntax.
public static bool IsInfinity(
float f
)
Parameters
Single.IsInfinity
has the following parameters.
f
- A single-precision floating-point number.
Returns
Single.IsInfinity
method returns true if f evaluates to PositiveInfinity or NegativeInfinity; otherwise,
false.
Example
The following code example demonstrates the IsInfinity method.
/* www . j a va 2 s. c o m*/
using System;
public class MainClass{
public static void Main(String[] argv){
// This will return "true".
Console.WriteLine("IsInfinity(3.0F / 0) == {0}.", Single.IsInfinity(3.0F / 0) ? "true" : "false");
}
}
The code above generates the following result.