Product SiteDocumentation Site

2.16. NUMERIC


>>-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 in Chapter 10, Numbers and Arithmetic.
NUMERIC DIGITS
controls the precision to which arithmetic operations and built-in functions are evaluated. If you omit expression1, the precision defaults to 9 digits, but can be overridden on a source-file basis using the ::OPTIONS directive (Section 3.5, “::OPTIONS”. Otherwise, the character string value result of 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), but high precisions are likely to require a great amount of processing time. It is recommended that you use the default value whenever possible.
You can retrieve the current NUMERIC DIGITS setting with the DIGITS built-in function. See Section 7.4.27, “DIGITS”.
NUMERIC FORM
controls the form of exponential notation for the result of arithmetic operations and built-in functions. This can 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 character string 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 7.4.32, “FORM”.
NUMERIC FUZZ
controls how many digits, at full precision, are ignored during a numeric comparison operation. (See Section 10.4, “Numeric Comparisons”.) If you omit expression3, the default is 0 digits. Otherwise, the character string value result of 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 7.4.34, “FUZZ”.

Note

The three numeric settings are automatically saved across internal subroutine and function calls. See the CALL instruction (Section 2.3, “CALL”) for more details.