Table of Contents

Method Ceiling

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

Ceiling(double)

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

public static double Ceiling(double value)

Parameters

value double

A double-precision floating-point number to be rounded up.

Returns

double

The smallest integral value that is greater than or equal to value. If value is equal to NaN, PositiveInfinity, or NegativeInfinity, the same value is returned.

Remarks

This method uses the IEEE 754 standard for rounding. The return value is of type double, even though it represents an integral value.

Ceiling(float)

Returns the smallest integral value greater than or equal to the specified single-precision float. Behaves like Ceiling(double) including handling of NaN and infinities.

public static float Ceiling(float value)

Parameters

value float

The value to round up.

Returns

float

The smallest integral float greater than or equal to value.

Examples

Ceiling(3.14f);       // returns 4.0f
Ceiling(-2.7f);       // returns -2.0f
Ceiling(float.NaN);   // returns float.NaN
Ceiling(float.PositiveInfinity); // returns float.PositiveInfinity
Ceiling(float.NegativeInfinity); // returns float.NegativeInfinity

Remarks

This method mimics Ceiling(double) behavior for float values, including correct handling of special IEEE 754 values.