Function Reference


Int

Returns the integer (whole number) representation of an expression.

Int ( expression [, flag ] )

Parameters

expression An expression to convert into an integer.
flag [optional] Defines behavior.
Can be one of the following:
  Default = the result is auto-sized integer. See remarks.
  1 = the result is 32bit integer.
  2 = the result is 64bit integer.

Return Value

Success: Returns an integer.

Remarks

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.
Fractional portions are truncated, so Int(1.999999) returns 1
Int(0/0) returns -9223372036854775807, if you were wondering.
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).

Related

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

Example


Local $var = Int(10.793) ;$var is the integer 10