Rev Language Reference


abs - Absolute value of a number

The 'abs' function returns the absolute value of a number.

Usage

abs(Real x)

Arguments

x : Real (pass by const reference)
A (possibly negative) number.

Return Type

Example

# compute the absolute value of a real number
number <- -3.0
absoluteValueOfTheNumber <- abs(number)
if (number + absoluteValueOfTheNumber != 0.0) {
    print("Problem when computing an absolute value.")
} else {
    print("Correct computation of an absolute value.")
}

See Also