Try OpenEdge Now
skip to main content
ABL Essentials
Using Basic ABL Constructs : Putting a calculation into your procedure : Arithmetic built-in functions
 

Arithmetic built-in functions

The following table describes some of the useful built-in functions that extend the basic set of numeric operands.
Table 10. Arithmetic built-in functions
Function
Arguments
Returned value
ABSOLUTE
value AS INTEGER or DECIMAL
INTEGER or DECIMAL — The absolute value of the numeric value.
EXP
base AS INTEGER or DECIMAL, exponent AS INTEGER or DECIMAL
INTEGER or DECIMAL — The result of raising the base number to the exponent power.
LOG
expression AS DECIMAL, base AS INTEGER or DECIMAL
DECIMAL — The logarithm of the expression using the specified base. The base is optional; the natural logarithm, base (e), is returned by default.
MAXIMUM
Two or more expressions AS INTEGER or DECIMAL
INTEGER or DECIMAL — The largest value of the expressions.
MINIMUM
Two or more expressions AS INTEGER or DECIMAL
INTEGER or DECIMAL — The smallest value of the expressions.
MODULO
Special syntax: expression MODULO base
INTEGER — The remainder after division. The expression and base must be INTEGER values.
RANDOM
low-value AS INTEGER, high-value AS INTEGER
INTEGER — A random INTEGER value between the low-value and the high-value (inclusive). There is a Random (–rand) ABL startup option that determines whether a different set of values is returned for each OpenEdge session.
ROUND
expression AS DECIMAL, precision AS (positive) INTEGER
DECIMAL — The DECIMAL expression rounded to the number of decimal places specified by the precision. The rounding is down for all values beyond the precision that are less than .5, and up for all higher values.
SQRT
expression AS INTEGER or DECIMAL
DECIMAL — The square root of the expression.
TRUNCATE
expression AS DECIMAL, precision AS (non-negative) INTEGER
DECIMAL — The expression truncated to the specified precision.