Function reference · Math

trunc

Drops the fractional part of a number, rounding toward zero.

For a symbol, the call is returned unevaluated.

Notation

trunc(x)

Write it in an expression: nerdamer('trunc(3.7)'), or in the Playground.

nerdamer.trunc

nerdamer.trunc(x: ExpressionInput): Expression

A method on the default import. Arguments can be strings, as in Notation.

Examples

A positive number.

trunc(3.7)
// → 3
Open in Playground

A negative number rounds toward zero.

trunc(-2.7)
// → -2
Open in Playground

← Back to Function reference