
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.2 . The Guide To CA-Clippe - <b>abs()</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ABS()
Return the absolute value of a numeric expression
------------------------------------------------------------------------------
Syntax
ABS(<nExp>) --> nPositive
Arguments
<nExp> is the numeric expression to evaluate.
Returns
ABS() returns a number representing the absolute value of its argument.
The return value is a positive number or zero.
Description
ABS() is a numeric function that determines the magnitude of a numeric
value independent of its sign. It lets you, for example, obtain the
difference between two numbers as a positive value without knowing in
advance which of the two is larger.
As a formalism, ABS(x) is defined in terms of its argument, x, as
follows: if x >= 0, ABS(x) returns x; otherwise, ABS(x) returns the
negation of x.
Examples
. These examples show typical results from ABS():
nNum1 := 100
nNum2 := 150
? nNum1 - nNum2 // Result: -50
? ABS(nNum1 - nNum2) // Result: 50
? ABS(nNum2 - nNum1) // Result: 50
? ABS(-12) // Result: 12
? ABS(0) // Result: 0
Files: Library is CLIPPER.LIB.
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson