Skip to main content

trunc

Overloads

NameDescription
trunc(integer p) -> integerTruncates the given value to the nearest integer not greater in magnitude.
trunc(real p) -> realTruncates the given value to the nearest integer not greater in magnitude.
trunc(bool p) -> boolTruncates the given value to the nearest integer not greater in magnitude.

trunc(integer p) -> integer

Truncates the given value to the nearest integer not greater in magnitude.

Parameters

  • p: The value to truncate.

Example


trunc(true) // returns true
trunc(5) // returns 5
trunc(-2.9) // returns -2
trunc(3.7) // returns 3

trunc(real p) -> real

Truncates the given value to the nearest integer not greater in magnitude.

Parameters

  • p: The value to truncate.

Example


trunc(true) // returns true
trunc(5) // returns 5
trunc(-2.9) // returns -2
trunc(3.7) // returns 3

trunc(bool p) -> bool

Truncates the given value to the nearest integer not greater in magnitude.

Parameters

  • p: The value to truncate.

Example


trunc(true) // returns true
trunc(5) // returns 5
trunc(-2.9) // returns -2
trunc(3.7) // returns 3