abs
- Absolute value of a number
x : | Real (pass by const reference) |
A (possibly negative) number. |
# 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.")
}