MathF.Abs(Single) 方法

定义

返回单精度浮点数字的绝对值。

public:
 static float Abs(float x);
public static float Abs (float x);
static member Abs : single -> single
Public Shared Function Abs (x As Single) As Single

参数

x
Single

大于或等于 Single.MinValue 但小于或等于 Single.MaxValue 的数字

返回

单精度浮点数 x,例如 0 ≤ x ≤ Single.MaxValue

注解

Single 绝对值是其不带符号的数值。 例如,1.2e-03 和 -1.2e03 的绝对值为 1.2e03。

如果 x 等于 NegativeInfinityPositiveInfinity,则返回值为 PositiveInfinity。 如果 x 等于 NaN,则返回值为 NaN

适用于