ABS Function
Returns the absolute value of a number.
| Category: |
Mathematical |
| Returned data type: |
Real |
| Note: |
The ABS function returns a nonnegative number that is
equal in magnitude to the magnitude of the argument.
|
Syntax
Required Argument
argument
specifies a value that
has a real data type; this can be specified as a numeric constant,
field name, or expression.
Examples
Example 1
|
Statements
|
Results
|
|
x = abs(3.5)
|
// outputs 3.5
|
|
x = abs(-7)
|
// outputs 7
|
|
x = abs(-3*1.5)
|
// outputs 4.5
|
Example 2
real seconds_diff
seconds_diff = abs((date1 - date2) * 86400)
// The number 86400 represents the total number of seconds in a day