函数参考


Int

返回某个表达式的整数(整数部分)值.

Int ( 表达式 [, 标志 ] )

参数

表达式 要转换为整数的表达式.
标志 [可选参数] 定义效果.
可以是下方的一个值:
  Default(默认) = 结果为自动分配大小的整数.参考备注.
  1 = 结果为 32 位整数.
  2 = 结果为 64 位整数.

返回值

成功: 返回整数.

注意/说明

Default behavior is that if the result is within range of 32bit integer then 32bit integer is returned. If not, 64bit integer is returned. Both signed.
小数部分将被约去,因此 Int(1.999999) 的返回值将是 1
Int(0/0) 的返回值将是 -9223372036854775807.令人奇怪?
This function makes minor corrects to floating point numbers to account for the imprecise nature of floating point numbers. For example, the floating point expression 0.7 + 0.2 + 0.1 produces a floating point number that is not quite 1.0. Int() corrects for this anomaly, however, certain extremely rare circumstances may lead to Int() returning an unexpected value (the odds of getting an unexpected value are less than if Int() did not attempt any correction at all).

相关

Number, String, Round, HWnd, Binary, Ceiling, Floor, Ptr, Mod

示例/演示


Local $var = Int(10.793) ;$var 为整数值 10