Caché Basic Reference
Abs
[Home]  [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

Returns the absolute value of a number.
Synopsis
Abs(number)
Arguments
The number argument can be any valid numeric expression. If number is an uninitialized variable or a non-numeric value, Abs returns 0 (zero).
Description
The absolute value of a number is its unsigned magnitude. For example, Abs(-1) and Abs(1) both return 1. Abs removes signs, and leading and trailing zeros from number.
Examples
The following example uses the Abs function to compute the absolute value of a number:
Println Abs(0050.300)  'Returns 50.3
Println Abs(-50.3)     'Returns 50.3
Println Abs(+50.3)     'Returns 50.3
Println Abs(0)         'Returns 0
Println Abs(-0)        'Returns 0
 
See Also