Function reference · Math

numeric

Evaluates a number to a given number of significant digits.

It works on numbers, vectors, matrices and sets. Symbolic parts stay symbolic; only fully numeric values are evaluated. In JavaScript it is nerdamer.numeric.

Notation

numeric(value[, precision])

Write it in an expression: nerdamer('numeric(1/3,5)'), or in the Playground.

nerdamer.numeric

nerdamer.numeric(value: ExpressionInput, precision?: ExpressionInput): Expression

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

Parameters

value
Value to evaluate numerically.
precision
Optional positive number of significant digits. Defaults to the active Nerdamer precision.

Examples

Five significant digits.

numeric(1/3,5)
// → 0.33333
Open in Playground

Each element of a vector.

numeric([1/3,2/3],5)
// → [0.33333, 0.66667]
Open in Playground

Thirty digits of pi.

numeric(pi,30)
// → 3.14159265358979323846264338328
Open in Playground

A symbolic value stays as it is.

numeric(x/3,5)
// → (1/3)*x
Open in Playground

← Back to Function reference