Function reference · Math

mod

Returns the remainder of a division.

The result has the sign of the divisor, so mod(-7,3) is 2. Decimals work. For a symbol, the call is returned unevaluated. A zero divisor is an error.

Notation

mod(arg1, arg2)

Write it in an expression: nerdamer('mod(7,2)'), or in the Playground.

nerdamer.mod

nerdamer.mod(...args: [x, y]): Expression

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

Examples

An integer remainder.

mod(7,2)
// → 1
Open in Playground

The result takes the divisor's sign.

mod(-7,3)
// → 2
Open in Playground

A decimal.

mod(7.5,2)
// → 1.5
Open in Playground

A symbol: unevaluated.

mod(x,2)
// → mod(x, 2)
Open in Playground

← Back to Function reference