MathF.Floor(Single) 方法

定义

返回小于等于指定单精度浮点数的最大整数值。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

参数

x
Single

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

返回

小于或等于 x 的最大整数值。The largest integral value less than or equal to x. 如果 x 等于 NaNNegativeInfinityPositiveInfinity,则返回该值。If x is equal to NaN, NegativeInfinity, or PositiveInfinity, that value is returned.

注解

此方法的行为遵循 IEEE 标准754第4部分。The behavior of this method follows IEEE Standard 754, section 4. 这种舍入有时称为舍入向负无穷。This kind of rounding is sometimes called rounding toward negative infinity. 换言之, 如果x为正, 则会截断任何小数部分。In other words, if x is positive, any fractional component is truncated. 如果x为负, 则任何小数部分的存在都将导致它舍入为较小的整数。If x is negative, the presence of any fractional component causes it to be rounded to the smaller integer. 此方法的操作不同于Ceiling方法, 后者支持向正无穷舍入。The operation of this method differs from the Ceiling method, which supports rounding toward positive infinity.

适用于

另请参阅