Numeric Functions and Expressions

Functions

PRO/5 provides many built-in numeric functions such as ABS() and INT(). These functions return numeric values and may be used any place a numeric value is legal.

Expressions

Numeric values and arithmetic operators may be combined to perform calculations. The following is a list of PRO/5 numeric operators in order of precedence. Operators with the same precedence are executed left to right.

Operator

Description

Example

-

Unary minus.

LET A=-B

^

Exponentiation. A number may be raised to an integer or non-integer power.

LET A=B^C

* /

Multiplication and division.

LET A=B*C,X=Y/Z

+ -

Addition and subtraction.

 

< > = <= >= <>

Relational Operators. Used to compare two numeric values or two strings. If the relation is true, the result is 1. Otherwise, the result is 0. When comparing two numbers, their values are rounded to the current precision during the compare. See the PRECISION verb for more information.

LET A=B<C

AND OR

Logical operators. The result of AND will be 0 if either or both of its operands are zero; otherwise, the result will be 1. The result of OR will be 0 if both of its operands are zero; otherwise, the result will be 1. PRO/5 will "short-circuit" the AND and OR operators if the result is known after evaluating just the first operand. In this case, PRO/5 will skip evaluation of the second operand.

LET A=B OR C,X=Y AND Z

Parentheses may be used to change the order of execution of operators. PRO/5 supports at least 10 levels of parenthetic nesting (multi-line functions may reduce this). Array subscripts and function calls are also considered nesting.