abs()

Returns the absolute value of the input value.

Synopsis

abs(x)

Description

The abs() function calculates the absolute value of a single input value.

Parameters

x

an expression that evaluates to a numeric value

Returns

The absolute value of the given value.

Examples

The following statement finds the absolute value of \(2\), which is also \(2\).

abs(2)

This example sets a variable to the value \(2\), which is the absolute value of \(-2\).

my_variable = abs(-2)

Errors

It is an error if a non-numeric variable is supplied as a parameter.

See Also

ceil(), floor()