Skip to main content

Software > Software Development > IBM REXX Family >

NetRexx

Technical detail

Numeric Instruction

    numeric digits [exprd];
form [scientific];
[engineering];

The numeric instruction is used to change the way in which arithmetic operations are carried out by a program. The effects of this instruction are described in detail in the section on Numbers and Arithmetic.

numeric digits

controls the precision under which arithmetic operations will be evaluated. If no expression exprd is given 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 before it is used. The value used must be a positive whole number.

There is normally no limit to the value for numeric digits (except the constraints imposed by the amount of storage and other resources available) but note that high precisions are likely to be expensive in processing time. It is recommended that the default value be used wherever possible.

Note that small values of numeric digits (for example, values less than 6) are generally only useful for very specialized applications. The setting of numeric digits affects all computations, so even the operation of loops may be affected by rounding if small values are used.

If an implementation does not support a requested value for numeric digits then the instruction will fail with an exception (which may, as usual, be caught with the catch clause of a control construct).

The current setting of numeric digits may be retrieved with the digits special word.

numeric form

controls which form of exponential notation is to be used for the results of operations. This may be either scientific (in which case only one, non-zero, digit will appear before the decimal point), or engineering (in which case the power of ten will always be a multiple of three, and the part before the decimal point will be in the range 1 through 999). The default notation is scientific.

The form is set directly by the sub-keywords scientific or engineering; if neither sub-keyword is given, scientific is assumed. The current setting of numeric form may be retrieved with the form special word.

If an implementation does not support a requested value for numeric form then the instruction will fail with an exception (which may, as usual, be caught with the catch clause of a control construct).

The numeric instruction may be used where needed as a dynamically executed instruction in a method.

It may also appear, more than once if necessary, before the first method in a class, in which case it forms the default setting for the initialization of subsequent properties in the class and for all methods in the class. In this case, any exception due to the numeric instruction is raised when the class is first loaded.

 

 

PreviousTable of contents Next
We're here to help
Easy ways to get the answers you need.
E-mail us

or call us at
877-426-3774
Priority code:
104CBW67