Acorn Computers BBC Micro Model B w/8271 — Acorn BBC Micro Model B w/8271 User Guide Manual PDF

173 ABS absolute value Purpose This function turns negative numbers into equivalent positive numbers but leaves positive numbers alone. For example the absolute value of -9.75 is 9.75 while the absolute value of 4.56 is 4.56. The ABS function is often used when calculating the difference between two values if you do not know which is the larger of the two. Thus (K-L) will be positive if K is greater than L, and will be negative if L is greater than K. For example, if K = 9 and L = 12 then (K - L) would be equal to -3. However the value of ABS(K-L) will always be positive. In the example given ABS(K-L) would equal 3.

205 error=ABS(DIFFERENCE) Examples 100 DIFF=ABS(X2-X1) PRINT ABS(temp%-50) Description A function giving the absolute value of its argument. Syntax = ABS ( ) Associated keywords SGN