Double.IsInfinity(Double) 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(double d);
public:
static bool IsInfinity(double d) = System::Numerics::INumberBase<double>::IsInfinity;
public static bool IsInfinity (double d);
static member IsInfinity : double -> bool
Public Shared Function IsInfinity (d As Double) As Boolean
Parameters
- d
- Double
A double-precision floating-point number.
Returns
true
if d
evaluates to PositiveInfinity or NegativeInfinity; otherwise, false
.
Implements
Examples
The following code example illustrates the use of IsInfinity:
// This will return S"true".
Console::WriteLine( "IsInfinity(3.0 / 0) == {0}.", Double::IsInfinity( 3.0 / zero ) ? (String^)"true" : "false" );
// This will return "true".
Console.WriteLine("IsInfinity(3.0 / 0) == {0}.", Double.IsInfinity(3.0 / 0) ? "true" : "false");
// This will return "true".
printfn $"IsInfinity(3.0 / 0) = %b{Double.IsInfinity(3. / 0.)}."
' This will return "True".
Console.Write("IsInfinity(3.0 / 0) = ")
If Double.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.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om