MathF.Ceiling(Single) 方法


返回大于等于指定的单精度浮点数的最小整数值。Returns the smallest integral value that is greater than or equal to the specified single-precision floating-point number.

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



单精度浮点数。A single-precision floating-point number.


大于或等于 x 的最小整数值。The smallest integral value that is greater than or equal to x. 如果 x 等于 NaNNegativeInfinityPositiveInfinity,则返回该值。If x is equal to NaN, NegativeInfinity, or PositiveInfinity, that value is returned. 请注意,此方法返回 Single,而不是整数类型。Note that this method returns a Single instead of an integral type.


此方法的行为遵循 IEEE 标准754第4部分。The behavior of this method follows IEEE Standard 754, section 4. 这种类型的舍入有时称作向正无穷舍入。This kind of rounding is sometimes called rounding toward positive infinity. 换言之, 如果x为正, 则任何小数部分的存在都会导致x舍入到下一个最大的整数。In other words, if x is positive, the presence of any fractional component causes x to be rounded to the next highest integer. 如果x为负, 则舍入操作将导致丢弃的x任何小数部分。If x is negative, the rounding operation causes any fractional component of x to be discarded. 此方法的操作不同于Floor(Single)方法, 后者支持向负无穷舍入。The operation of this method differs from the Floor(Single) method, which supports rounding toward negative infinity.