Function Reference


Int

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

Int ( expression [, flag = 0] )

Parameters

expression An expression to convert into an integer.
flag [optional] Defines behavior.
Can be one of the following:
    $NUMBER_AUTO (0) = (default) the result is auto-sized integer. See remarks.
    $NUMBER_32BIT (1) = string is interpreted as a 32bit integer
    $NUMBER_64BIT (2) = string is interpreted as a 64bit integer

Constants are defined in "AutoItConstants.au3".

Return Value

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

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

Example

#include <MsgBoxConstants.au3>

; Assign a Local variable the int representation of 10.793.
Local $iInt = Int(10.793)

; Display the result.
MsgBox($MB_SYSTEMMODAL, "", $iInt)