Прочетете на английски Редактиране

Споделяне чрез


MathF.Abs(Single) Method

Definition

Returns the absolute value of a single-precision floating-point number.

C#
public static float Abs(float x);

Parameters

x
Single

The number to take the absolute value of.

Returns

The absolute value of x

Remarks

The absolute value of a Single is its numeric value without its sign. For example, the absolute value of both 1.2e-03 and -1.2e03 is 1.2e03.

If x is equal to NegativeInfinity or PositiveInfinity, the return value is PositiveInfinity. If x is equal to NaN, the return value is NaN.

Applies to

Продукт Версии
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1