abs

To return the absolute value of a number

The function removes existing signs and returns the absolute, positive value of a number.

It happens rather rarely, but for certain calculations, it may be necessary to continue calculating with the positive value of a possibly negative result. In such cases the function saves querying the value and, if necessary, changing the sign by multiplication.

Syntax

abs(number)

Return

number

Examples

abs(-9.3)

Result: 9.3

See also

sign, which returns the signum of a number.

Last updated