Function Reference

Int

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

Int ( expression )

 

Parameters

expression An expression to convert into an integer.

 

Return Value

Success: Returns a integer.
Failure: Returns 0 sets @error to 1 if not an integer, float or string.

 

Remarks

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

 

Example


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