Rev Language Reference

abs - Absolute value of a number

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


abs(Real x)


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

Return Type


# 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