trunc

returns the integer part of a number.

# Metadata

Platforms: desktop, server, mobile OS: mac, windows, linux, ios, android Introduced: 1.0 Security:

# Syntax

the trunc of number

# Params

- number : Any number, or expression that evaluates to a number.

# Examples

trunc(33.567) -- returns 33

trunc(-6.3) -- returns -6

# Description

Use the trunc function to round a number down.

The trunc function is different from round in that truncation completely ignores the fractional part of the number. For example, round(4.9) returns 5, but trunc(4.9) returns 4. This means that the trunc function does not always return the integer closest to the number.

# Tags

# See

- **keyword:** integer - **constant:** return - **function:** abs, round - **control structure:** function - **glossary:** return