Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Single.IsInfinity(Single) Method

Definition

Namespace:
System
Assemblies:
mscorlib.dll, System.Runtime.dll
Assemblies:
netstandard.dll, System.Runtime.dll
Assembly:
System.Runtime.dll
Assembly:
mscorlib.dll
Assembly:
netstandard.dll
Source:
Single.cs
Source:
Single.cs
Source:
Single.cs
Source:
Single.cs
Source:
Single.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Returns a value indicating whether the specified number evaluates to negative or positive infinity.

public:
 static bool IsInfinity(float f);
public:
 static bool IsInfinity(float f) = System::Numerics::INumberBase<float>::IsInfinity;
public static bool IsInfinity(float f);
static member IsInfinity : single -> bool
Public Shared Function IsInfinity (f As Single) As Boolean

Parameters

f
Single

A single-precision floating-point number.

Returns

true if f evaluates to PositiveInfinity or NegativeInfinity; otherwise, false.

Implements

Examples

The following code example demonstrates the IsInfinity method.

// This will return "true".
Console.WriteLine("IsInfinity(3.0F / 0) == {0}.", Single.IsInfinity(3.0F / 0) ? "true" : "false");
// This will return "true".
printfn $"IsInfinity(3.0F / 0) == %b{Single.IsInfinity(3f / 0f)}."
' This will return "True".
Console.Write("IsInfinity(3.0 / 0) = ")
If Single.IsPositiveInfinity(3 / 0) Then
 Console.WriteLine("True.")
Else
 Console.WriteLine("False.")
End If

Remarks

Floating-point operations return PositiveInfinity or NegativeInfinity to signal an overflow condition.

Applies to

See also


Feedback

Was this page helpful?