Double.IsInfinity(Double) Metod

Definition

Returnerar ett värde som anger om det angivna talet utvärderas till negativ eller positiv oändlighet.

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

Parametrar

d
Double

Ett flyttal med dubbel precision.

Returer

true om d utvärderas till PositiveInfinity eller NegativeInfinity; annars , false.

Implementeringar

Exempel

Följande kodexempel illustrerar användningen av IsInfinity:

// 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

Kommentarer

Flyttalsåtgärder returnerar PositiveInfinity eller NegativeInfinity signalerar ett spilltillstånd.

Gäller för

Se även