Caché MultiValue Basic Reference
Returns the absolute value of a number.
||An expression that resolves to a number or a numeric string.
The absolute value of a number is its unsigned magnitude. For example, ABS
(-1) and ABS
(1) both return 1. ABS
returns a number in canonical form; it removes plus and minus signs and leading and trailing zeros from number
. A string is parsed as a number until a non-numeric character is encountered. Thus 7dwarves is parsed as 7. If number
is the empty string ("") or a non-numeric value, ABS
returns 0 (zero).
function gives the absolute value of a number: all numbers become positive. The NEG
function inverts the sign of a number: negative numbers become positive and positive numbers become negative.
The following example uses the ABS
function to compute the absolute value of a number:
PRINT ABS(0050.300); ! Returns 50.3
PRINT ABS(-50.3); ! Returns 50.3
PRINT ABS(+50.3); ! Returns 50.3
PRINT ABS(0); ! Returns 0
PRINT ABS(-0); ! Returns 0