![background image](http://html1.mh-extra.com/html/olivetti/programma-101/programma-101_reference-manual_3789955045.webp)
Rounding Techniques
Following are routines for rounding to the setting of the Decimal Wheel in addition, subtraction
and multiplication. Assume one value is stored in the B register and the second value in the e
register:
___________________________________________________________________________
ADDITION SUBTRACTION MULTIPLICATION
___________________________
B
B
B
Transfer first value to A register.
C +
C -
C x
Perform operation.
R -
R -
R -
Subtract complete result from trun cated result.
Transfer complete result to A register.
R -
R -
R -
Subtract negative remainder from complete result.
A
A
A
Print rourded result.
___________________________________________________________________________
Following are techniques for rounding the Quotient in a division problem to the setting of the
Decimal Wheel:
METHOD 1:
Assume the divisor is in register B and the dividend is in register C.
C
Transfer dividend to A register.
B
÷
Divide dividend by divisor.
R
Transfer iemainder to A register.
C +
Add dividend to remainder.
R
Transfer decimally correct di remainder to A register.
B
÷
Divide di remainder by divisor.
A
Print rounded Quotient.
This routine requires 7 instructions.
- 45 -