FANDOM


Returns the integer part of a number.

Built-in Function handler Edit

Syntax:

trunc(<number>)

Examples:

trunc(33.567) -- returns 33
trunc(-6.3) -- returns -6

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(constant) the integer closest to the number.

Parameters:

  • number: Any number, or expression that evaluates to a number.
  • Returns: The trunc function returns an integer.

See also: abs (function),round (function),

Community content is available under CC-BY-SA unless otherwise noted.