function
int
int(x) -> int / long(x) -> long
Converts a float, double, fixed or long to an int (or, with long(x), to a long). Floating-point values truncate toward zero, as in C: int(2.9) is 2 and int(-2.9) is -2. A fixed value rounds down, like floor. For other rounding use Math.floor, Math.ceil or Math.round.
Parameters
xthe number to convertExample
program Whole {
entry {
let pixels: float = 12.75
print(int(pixels)) # 12
print(long(pixels * 1000.0)) # 12750
}
}