MathF.Floor(Single) Method

Definition

Returns the largest integral value less than or equal to the specified single-precision floating-point number.

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

Parameters

x
Single

The number to take the floor of.

Returns

The floor of x

Remarks

The behavior of this method follows IEEE Standard 754, section 4. This kind of rounding is sometimes called rounding toward negative infinity. In other words, if x is positive, any fractional component is truncated. If x is negative, the presence of any fractional component causes it to be rounded to the smaller integer. The operation of this method differs from the Ceiling method, which supports rounding toward positive infinity.

Applies to

See also