MathF.Abs(Single) Method

Definition

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

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

Parameters

x
Single

A number that is greater than or equal to Single.MinValue, but less than or equal to Single.MaxValue.

Returns

A single-precision floating-point number, x, such that 0 ≤ x ≤ Single.MaxValue.

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