Edit

Share via


MathF.Floor(Single) Method

Definition

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

C#
public static float Floor(float x);

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

Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Standard 2.0 (package-provided), 2.1

See also