NetRexx Overview, version 2.02
Copyright (c) IBM Corporation, 2001. All rights reserved. ©
| 22 May 2001 |

[previous | contents | next] |

'1234' '12.03' '-12' '120e+7'The arithmetic operations in NetRexx are designed for people rather than machines, so are decimal rather than binary, do not overflow at certain values, and follow the rules that people use for arithmetic. The operations are completely defined by the ANSI X3.274 standard for Rexx, so correct implementations always give the same results.

An unusual feature of NetRexx arithmetic is the **numeric**
instruction: this may be used to select the *arbitrary
precision* of calculations. You may calculate to whatever
precision that you wish (for financial calculations, perhaps), limited
only by available memory. For example:

numeric digits 50 say 1/7which would display

0.14285714285714285714285714285714285714285714285714The numeric precision can be set for an entire program, or be adjusted at will within the program. The

NetRexx also provides simple access to the native binary arithmetic of computers. Using binary arithmetic offers many opportunities for errors, but is useful when performance is paramount. You select binary arithmetic by adding the instruction:

options binaryat the top of a NetRexx program. The language processor will then use binary arithmetic instead of NetRexx decimal arithmetic for calculations, if it can, throughout the program.

[previous | contents | next]

From
*The NetRexx Language* by
Mike Cowlishaw,