Single.PositiveInfinity 字段

定义

表示正无穷。 此字段为常数。

public: float PositiveInfinity = Infinity;
public const float PositiveInfinity = Infinity;
val mutable PositiveInfinity : single
Public Const PositiveInfinity As Single  = Infinity

字段值

Single

示例

下面的代码示例演示了 PositiveInfinity 常量。

// This will equal Infinity.
Console::WriteLine( "PositiveInfinity plus 10.0 equals {0}.", (Single::PositiveInfinity + 10.0) );
// This will equal Infinity.
Console.WriteLine("PositiveInfinity plus 10.0 equals {0}.", (Single.PositiveInfinity + 10.0).ToString());
// This will equal Infinity.
printfn $"PositiveInfinity plus 10.0 equals {Single.PositiveInfinity + 10f}."
' This will equal Infinity.
Console.WriteLine("PositiveInfinity plus 10.0 equals " + (Single.PositiveInfinity + 10).ToString() + ".")

注解

此常量的值是将正数除以零的结果。

当操作的结果大于 MaxValue时返回此常量。

用于 IsPositiveInfinity 确定值是否计算结果为正无穷大。

适用于

另请参阅