Single.IsInfinity(Single) Method
Definition
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 S"true".
Console::WriteLine( "IsInfinity(3.0F / 0) == {0}.", Single::IsInfinity( 3.0F / zero ) ? (String^)"true" : "false" );
// 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
https://aka.ms/ContentUserFeedback.
Binnenkort: Gedurende 2024 worden GitHub Issues uitgefaseerd als het feedbackmechanisme voor inhoud. Dit wordt vervangen door een nieuw feedbacksysteem. Ga voor meer informatie naar:Feedback verzenden en bekijken voor