NUMERIC

Purpose

Read syntax diagramSkip visual syntax diagram>>-NUMERIC--+-DIGITS--+-------------+----------+--;------------><
            |         '-expression1-'          |
            |       .-SCIENTIFIC-------------. |
            +-FORM--+------------------------+-+
            |       +-ENGINEERING------------+ |
            |       '-+-------+--expression2-' |
            |         '-VALUE-'                |
            '-FUZZ--+-------------+------------'
                    '-expression3-'
 

NUMERIC changes the way in which a program carries out arithmetic operations. The options of this instruction are described in detail on pages ***-***, but in summary:

NUMERIC DIGITS
controls the precision to which arithmetic operations and arithmetic built-in functions are evaluated. If you omit expression1, the precision defaults to 9 digits. Otherwise, expression1 must evaluate to a positive whole number and must be larger than the current NUMERIC FUZZ setting.

There is no limit to the value for DIGITS (except the amount of storage available--see the note on page *** for more information) but note that high precisions are likely to require a good deal of processing time. It is recommended that you use the default value wherever possible.

You can retrieve the current NUMERIC DIGITS setting with the DIGITS built-in function, see section DIGITS.

NUMERIC FORM
controls which form of exponential notation REXX uses for the result of arithmetic operations and arithmetic built-in functions. This may be either SCIENTIFIC (in which case only one, nonzero digit appears before the decimal point) or ENGINEERING (in which case the power of 10 is always a multiple of 3). The default is SCIENTIFIC. The subkeywords SCIENTIFIC or ENGINEERING set the FORM directly, or it is taken from the result of evaluating the expression (expression2) that follows VALUE. The result in this case must be either SCIENTIFIC or ENGINEERING. You can omit the subkeyword VALUE if expression2 does not begin with a symbol or a literal string (that is, if it starts with a special character, such as an operator character or parenthesis).

You can retrieve the current NUMERIC FORM setting with the FORM built-in function, see section FORM.

NUMERIC FUZZ
controls how many digits, at full precision, are ignored during a numeric comparison operation. (See page ***.) If you omit expression3, the default is 0 digits. Otherwise, expression3 must evaluate to 0 or a positive whole number, rounded if necessary according to the current NUMERIC DIGITS setting, and must be smaller than the current NUMERIC DIGITS setting.

NUMERIC FUZZ temporarily reduces the value of NUMERIC DIGITS by the NUMERIC FUZZ value during every numeric comparison. The numbers are subtracted under a precision of DIGITS minus FUZZ digits during the comparison and are then compared with 0.

You can retrieve the current NUMERIC FUZZ setting with the FUZZ built-in function, see section FUZZ.

Note:
The three numeric settings are automatically saved across internal and external subroutine and function calls. See the CALL instruction (page Purpose) for more details.