---
id: fn-int
name: int
category: builtins
kind: builtin
tokens: int long
sig: int(x) -> int / long(x) -> long
tip: Convert a number to a whole number, truncating toward zero.
order: 52
---
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:
- `x` — the number to convert
```ludic
program Whole {
entry {
let pixels: float = 12.75
print(int(pixels)) # 12
print(long(pixels * 1000.0)) # 12750
}
}
```