Reference abs()

abs()

Calculates the absolute value of a number.

A number's absolute value is its distance from zero on the number line. -5 and 5 are both five units away from zero, so calling abs(-5) and abs(5) both return 5. The absolute value of a number is always positive.

Examples

Syntax

abs(n)

Parameters

n

number to compute.

Notice any errors or typos? Please let us know. Please feel free to edit src/math/calculation.js and open a pull request!

Related References