Algosim documentation: trunc

trunc

Rounds to the nearest integer in the direction of 0.

Syntax

Description

If x is a real number, then trunc(x) is the integer obtained by truncating x, that is, by rounding x towards 0.

Examples

trunc(π)
3
trunc(e)
2
trunc(−π)
−3
trunc(−e)
−2

See also

Don’t confuse with