/* after the instruction */
Numeric form scientific
123.45 * 1e11 -> 1.2345E+13
/* after the instruction */
Numeric form engineering
123.45 * 1e11 -> 12.345E+12
Numeric Information
To determine the current settings of the NUMERIC options, use the built-in functions DIGITS, FORM, and
FUZZ. These functions return the current settings of NUMERIC DIGITS, NUMERIC FORM, and NUMERIC
FUZZ, respectively.
Whole Numbers
Within the set of numbers REXX understands, it is useful to distinguish the subset defined as whole
numbers. A whole number in REXX is a number that has a decimal part that is all zeros (or that has no
decimal part). In addition, it must be possible to express its integer part simply as digits within the
precision set by the NUMERIC DIGITS instruction. REXX would express larger numbers in exponential
notation, after rounding, and, therefore, these could no longer be safely described or used as whole
numbers.
Numbers Used Directly by REXX
As discussed, the result of any arithmetic operation is rounded (if necessary) according to the setting of
NUMERIC DIGITS. Similarly, when REXX directly uses a number (which has not necessarily been
involved in an arithmetic operation), the same rounding is also applied. It is just as though the number had
been added to 0.
In the following cases, the number used must be a whole number, and the largest number you can use is
999999999.
v The positional patterns in parsing templates (including variable positional patterns)
v The power value (right hand operand) of the power operator
v The values of exprr and exprf in the DO instruction
v The values given for DIGITS or FUZZ in the NUMERIC instruction
v Any number used in the numeric option in the TRACE instruction.
Errors
Two types of errors may occur during arithmetic:
v Overflow or Underflow
This error occurs if the exponential part of a result would exceed the range that the language processor
can handle, when the result is formatted according to the current settings of NUMERIC DIGITS and
NUMERIC FORM. The language defines a minimum capability for the exponential part, namely the
largest number that can be expressed as an exact integer in default precision. Because the default
precision is 9, VM supports exponents in the range -999999999 through 999999999.
Because this allows for (very) large exponents, overflow or underflow is treated as a syntax error.
v Insufficient storage
Storage is needed for calculations and intermediate results, and on occasion an arithmetic operation
may fail because of lack of storage. This is considered a terminating error as usual, rather than an
arithmetic error.
Numbers and Arithmetic
224
CICS TS for VSE/ESA: REXX Guide