NUMERIC

 ──NUMERIC─────┬──DIGITS─┬─────────────┬─────────┬──;──
                 │         └─expression──┘         │

                 ├──FORM──┬──────────────────────┬─┤
                 │        ├─SCIENTIFIC───────────┤ │

                 │        ├─ENGINEERING──────────┤ │

                 │        └─┬───────┬─expression─┘ │

                 │          └─VALUE─┘              │

                 └──FUZZ──┬──────────────┬─────────┘
                          └──expression──┘


The NUMERIC instruction is used to change the way in which arithmetic operations are carried out. The options of this instruction are described in detail in the OS/2 Procedures Language 2/REXX Reference.

NUMERIC DIGITS controls the precision to which arithmetic operations and arithmetic built-in functions are evaluated. If expression is omitted, then the default value of 9 is used. Otherwise the result of the expression is rounded, if necessary, according to the current setting of NUMERIC DIGITS. The value used must be a positive whole number that is larger than the current NUMERIC FUZZ setting.

There is no limit to the value for DIGITS (except the amount of storage available), but note that high precisions are likely to require a good deal of processor time. It is recommended that you use the default value wherever possible.

You can retrieve the current setting of NUMERIC DIGITS with the DIGITS built-in functionReference

NUMERIC FORM controls the form of exponential notation used by REXX 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 ten is always a multiple of three). The default is SCIENTIFIC. The FORM is set either directly by the subkeywords SCIENTIFIC or ENGINEERING or is taken from the result of evaluating the expression following VALUE. The result in this case must be either SCIENTIFIC or ENGINEERING. You can omit the subkeyword VALUE if the expression does not begin with a symbol or a literal string (for example, if it starts with a special character, such as an operator or parenthesis).

You can retrieve the current setting of NUMERIC FORM with the FORM built-in functionReference

NUMERIC FUZZ controls how many digits, at full precision, are ignored during a numeric comparison operation. If expression is omitted, the default is 0 digits. Otherwise expression must evaluate to 0 or a positive whole number rounded, if necessary, according to the current setting of NUMERIC DIGITS before it is used. The value used must be a positive whole number that is smaller than the current NUMERIC DIGITS setting.

FUZZ temporarily reduces the value of DIGITS by the FUZZ value before every numeric comparison operation. The numbers being compared are subtracted from each other under a precision of DIGITS minus FUZZ digits and this result is then compared with 0.

You can retrieve the current NUMERIC FUZZ setting with the FUZZ built-in functionReference

┴╓: The three numeric settings are automatically saved across subroutine and internal function calls. See the CALL instruction for more details.


[Back: NOP]
[Next: OPTIONS]