Function reference · Math

round

Rounds a number, to an integer or to a number of decimal places.

Halves round away from zero. For a symbol, the call is returned unevaluated.

Notation

round(x, n)

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

nerdamer.round

nerdamer.round(x: ExpressionInput, n?: ExpressionInput): Expression

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

Examples

To the nearest integer.

round(3.7)
// → 4
Open in Playground

To two decimal places.

round(2.555,2)
// → 2.56
Open in Playground

Halves round away from zero.

round(-2.5)
// → -3
Open in Playground

← Back to Function reference