z/OS TSO/E REXX Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Addition and subtraction

z/OS TSO/E REXX Reference
SA32-0972-00

If either number is 0, the other number, rounded to NUMERIC DIGITS digits, if necessary, is used as the result (with sign adjustment as appropriate). Otherwise, the two numbers are extended on the right and left as necessary, up to a total maximum of DIGITS + 1 digits (the number with the smaller absolute value may, therefore, lose some or all of its digits on the right) and are then added or subtracted as appropriate.

Example:
               xxx.xxx  +  yy.yyyyy
becomes:
               xxx.xxx00
            +  0yy.yyyyy
            -------------
               zzz.zzzzz

The result is then rounded to the current setting of NUMERIC DIGITS if necessary (taking into account any extra “carry digit” on the left after addition, but otherwise counting from the position corresponding to the most significant digit of the terms being added or subtracted). Finally, any insignificant leading zeros are removed.

The prefix operators are evaluated using the same rules; the operations +number and -number are calculated as 0+number and 0-number, respectively.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014