Olivetti Programma 101 Reference Manual page 46

Table of Contents

Advertisement

METHOD 2:
Assume the divisor is in register B and the dividend is in register A.
A +
Double dividend.
÷
B
Divide doubled dividend by the divisor.
A/
Special series to generate 2 in the M register.
D/
÷
Divide doubled quotient by 2.
R +
Round off.
A
Print rounded quotient.
This routine requires 7 instructions.
Following is a technique for rounding to some position lower than the setting of the Decimal
Wheel, e.g., round to 2 places when the Decimal Wheel is at 5. At the point where the routine
begins, assume the operation has been completed and the value to be rounded is in the A
register.
D/x
Multiply the contents of the A register by 10
/
Transfer the decimal portion of the contents of A to M;
+
Add decimal portion to contents of A.
/
Transfer the decimal portion of the contents of A to M.
-
Subtract decimal portion from the contents of A.
÷
D/
Divide the contents of the A register by 10
A
Print rounded answer.
This routine requires 7 instructions and 1 register containing a constant 10
to the position to which rounding is desired.
2
to shift decimal.
2
to shift the decimal.
- 46 -
n
where n is equal

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents