Go
to the first, previous,
next, last section, table
of contents.
The usual arithmetic operators are available for numeric computation.
Some of the operators work for both INTEGERs and REALs,
but INTEGERs and REALs may not be mixed in an expression.
For example, the expression 5 + 6.9 is illegal. Instead, use FLOAT(5)
+ 6.9 or 5.0 + 6.9. Here are the common infix binary operators:
- + (addition)
- computes sum of operands
- - (subtraction)
- computes difference of operands
- * (multiplication)
- computes product of operands
- DIV (integer division)
- computes integer quotient of operands
- / (REAL division)
- computes floating point quotient of operands
- MOD (modulus)
- computes integer remainder after a division
The following built-in arithmetic functions are also useful:
- ABS(a)
- returns -a if a < 0; otherwise, returns a
- MAX(a,b)
- returns the greater of a and b
- MIN(a,b)
- returns the lesser of a and b
For converting between INTEGERs and REALs, use the
following built-in functions:
- FLOAT(x [ "," REAL | LONGREAL | EXTENDED ])
- converts any kind of numeric value x to a floating point value (REAL
is the default).
- ROUND(x)
- converts a floating point value x to the nearest integer
- TRUNC(x)
- converts a floating point value x to the nearest integer in the direction
of 0.0
- FLOOR(x)
- returns the greatest integer not exceeding a floating point value x
- CEILING(x)
- returns the least integer not less than a floating point value x
Go to the first, previous,
next, last section, table
of contents.