System Functions
ABS( ) Absolute Value
 
Format ABS(num[,ERR=stmtref])
 
Where:
 
num Numeric expression whose absolute value is to be returned.
 
stmtref Program line number or statement label to which to transfer control.
 
Returns Numeric, absolute value of expression. Always positive or zero.
 
Description The ABS( ) function returns the absolute value of the numeric expression num. The value returned is a positive numeric value or zero. For instance, the absolute value of the numeric expression (X) is returned as follows:
 
ABS (X) ... If X>0 ... Returns X
 
ABS (X) ... If X<0 ... Returns X * -1 (positive result)
 
ABS (X) ... If X=0 ... Returns X (zero).
 
Examples 0010 INPUT "Give me your first number ",X
0020 INPUT "Give me another one ",Y
0030 PRINT "The difference is ",ABS(X-Y)
-:RUN
Give me your first number 12.345
Give me another one 23.456
The difference is 11.111