Edit

Share via


MathF.Ceiling(Single) Method

Definition

Returns the smallest integral value that is greater than or equal to the specified single-precision floating-point number.

C#
public static float Ceiling(float x);

Parameters

x
Single

The number to take the ceiling of.

Returns

The ceiling of x

Remarks

The behavior of this method follows IEEE Standard 754, section 4. This kind of rounding is sometimes called rounding toward positive infinity. In other words, if x is positive, the presence of any fractional component causes x to be rounded to the next highest integer. If x is negative, the rounding operation causes any fractional component of x to be discarded. The operation of this method differs from the Floor(Single) method, which supports rounding toward negative 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, 10
.NET Standard 2.0 (package-provided), 2.1

See also