From Scriptwiki
Jump to: navigation, search

Returns the specified integer number without rounding.

  • N is the number with decimals you want to handle.


The difference between $int and $floor is only visible with negative numbers. For example:

$floor(5.6)  ;returns 5
$int(5.6)    ;returns 5
$floor(-5.6) ;returns -6
$int(-5.6)   ;returns -5


$int($pi)  ;will return 3
$int(9312412.3213)  ;will return 9312412
var %i = 2.5
$calc(%i - $int(%i))  ;will return 0.5
$calc(%i % 1)  ;will also return 0.5

The above example shows how to return the remainder from a decimal number.

See also