The legal instructions of group 4 are concerned with the division process. Function-numbers 46 and 47 are unassigned and if encountered, will cause entry to the Monitor Routine, the program being suspended.

The functions numbered 40 to 45 each use two operands. One of these is the signed 48-bit number y. The other is either the signed 48-bit number x or the standard double-length number x:. In all cases x or x: is the dividend (numerator) and y is the divisor (denominator), i.e. the instructions divide x or x: by y.

In all cases if y = 0 the Monitor Program will be entered and the program suspended.

The results occupy either one word or two, depending on the actual function used. Single word results are written into Z in 3-address form and into X in 2-address form. Results which occupy two words are written into Z and Z+1 in 3-address form and into X and X+1 in 2-address form. Nothing should be assumed about the quotient and remainder of a division instruction which overflows.

**Function Number 40 [0100 000]**

(3) z_{I}' + (z*_{I}'/y_{I})
= x_{I}/y_{I}; 0
≤
z*_{I}'/y_{I} < 1

(2) As 3-address with x_{I}'
and x*_{I}' in place of z_{I}' and z*_{I}' respectively.

Unrounded division
of integers. Divide x_{I}
by y_{I}, writing the unrounded integral quotient into Z and the
remainder into Z+1. The remainder
is always of the same sign as y and numerically less than y.
The quotient and remainder, in 3-address form, satisfy

z_{I}'.y_{I} + z*_{I}' = x_{I}

OVR is set if x is -2^{47} and y is -1.

The results
obtained for selected values of x_{I} and y_{I} are tabulated
below.

x |
y |
z |
z* |

+37 |
+5 |
+7 |
+2 |

-37 |
+5 |
-8 |
+3 |

+37 |
-5 |
-8 |
-3 |

-37 |
-5 |
+7 |
-2 |

+1 |
+5 |
0 |
+1 |

+1 |
-5 |
-1 |
-4 |

Note also that:-

i)
z_{I}' = quotient, z*_{F}' = remainder when x_{F} is
divided y_{F
}ii) z_{F}' = unrounded quotient when x_{F} is divided by y_{I}.

Although the remainder is such that it can in turn be divided by y to give the non-negative l.s. half of a double-length quotient it is not necessary to do so, since the 42-instruction gives a result in this form.

**Function Number 41 [0100 001]**

(3) z_{I}'
= (x_{I}/y_{I})_{r} or (x_{F}/y_{F})_{r};
-½ ≤
x/y - z_{I}' < ½

(2) As 3-address
but with x_{I}' in place of z_{I}'.

Rounded division of integers. Divide x by y, to produce a rounded integral quotient, writing this into Z or X.

The
rounding is such that if the rounded quotient is subtracted from the true
quotient of x_{I}/y_{I} the difference is numerically less than
½ or equal to -½.**(See below)

** Editors note: This should be “and greater than or equal to -½”

In fact the rounded quotient is the nearest integer to x/y and is the algebraically greater if x/y is an odd multiple of ½.

The results of some selected cases are tabulated below.

x_{I}
y_{I}
z_{I}'

+13 +2 +7

-13 +2 -6

+13 -2 -6

-13 -2 +7

+37 +5 +7

-37 +5 -7

OVR is set if x = -2^{47} and y = -1.

**Function Number 42 [0010 010]**

(3) z:_{M}'
= (x_{I}/y_{I})_{r} or (x_{F}/y_{F})_{r};
-½ e
≤
(x/y) - z:_{M}' < ½ e

(2) As 3-address
but with x:_{M}' in place of z:_{M}'.

Division with rounded double-length quotient. Divide x by y to give a mixed-number quotient, writing the signed integral part into Z or X and the non-negative fractional part into Z+1 or X+1. OVR is set if

x_{I} = -2^{47} and y_{I} = -1

(or the fractional interpretations of those words).

The results given in some selected cases are tabulated below.

x |
y |
z |
z* |

+37 |
+8 |
+4 |
+0.625 |

-37 |
+8 |
-5 |
+0.375 |

+37 |
-8 |
-5 |
+0.375 |

-37 |
-8 |
+4 |
+0.625 |

+1 |
+8 |
0 |
+0.125 |

+1 |
-8 |
-1 |
+0.875 |

The quotient is rounded to the nearest multiple of 2^{-47}
and to the algebraically greater if the true value of x/y is an odd multiple of
2^{-48}.

Note
also that:-

i) z:_{F}'
= rounded d.l. quotient when x_{F} is divided by y_{I};

ii)
z:_{I}' = rounded d.l. quotient when x_{I} is divided by
y_{F}.

**Function Number 43 [0100
011]**

(3) z_{F}'
= (x_{F}/y_{F})_{r} or (x_{I}/y_{I})_{r}
; -½ e
≤
x/y - z_{F}' < ½ e
, |x| < |y| or x = -y

(2) As 3-address
but with x_{F}' in place of z_{F}'.

Rounded division of x by y producing a fractional quotient, which is written into Z, or X. The operands must be such that x is numerically less than y or is equal to -y. OVR is set if neither of these conditions is satisfied. If x and y have the same scaling factor (e.g. if both are fractions or if both are integers) than z' is a fraction.

The
result is the multiple of 2^{-47} nearest to the true value of x/y and
is the algebraically larger if x/y is an odd multiple of 2^{-48}.

Note
also that z_{I}’ = (x_{I}/y_{F})_{r}

This instruction can be used, following a 44-instruction, to produce a rounded standard double-length quotient when x: is divided by y.

(3) z_{I}'
+ (z*_{I}'/y_{I}) = x:_{I}/y_{I} ;
0 ≤
z*_{I}'/y_{I} < 1

(2) As 3-address
but with x_{I}' and x*_{I}' in place of z_{I}' and z*_{I}'.

Unrounded division with double-length dividend (numerator).

The standard d.l. number x: is divided by the s.l. number y producing an integral quotient and a remainder. The quotient is written into Z or X and the remainder into Z+1 or X+1. OVR is set if z' exceeds single-length capacity. If x: is not in standard form the OMP is entered; the OMP does a 'partial justify' and obeys the instruction.

For comments and examples relating to the values of quotients and remainders please see under function-number 40; in essence functions 40 and 44 differ only in using single-and double-length dividends respectively.

If the remainder from a 44-instruction is divided by the original divisor (using a 43-instruction) the result is necessarily a non-negative fraction. Thus if a is a standard d.l. number in A100 and A101 and if b is an s.l. number in A200 then after obeying the instructions

44
A100 A200
A7

43 A8 A200

A7 and A8 will together contain the standard d.l. mid-point (rounded) value of a/b, with the signed integral part in A7 and the non-negative fractional part in A8.

**Function number 45 [0100 101]**

(3) z_{F}'
= (x:_{F}/y_{F})_{r} or (x:_{M}/y_{I})_{r}
; -½ e
≤
(x:_{F}/y_{F}) - z_{F}' < ½ e

(2) As 3-address but with x_{F}'
in place of z_{F}'

Rounded
division with double-length dividend.
Divide the standard d.l. number x: by the s.l. number y to produce a
rounded fractional quotient, writing this quotient into Z or X.
The operands must be such that |x:_{F}| < |y_{F}| or
x:_{F} = -y_{F}. OVR
is set if neither of these conditions is satisfied.
If x: is not in standard form, the O&MP is entered; the OMP does a 'partial justify' and obeys the instruction.

The
result is that multiple of 2^{-47} which is nearest to the true value of
x:_{F}/y_{F} being the algebraically larger if the true quotient
is an odd multiple of 2^{-48}.

Note also that

z_{I}'
= (x:_{M}/y_{F})_{r} or (x:_{I}/y_{I})_{r}
; -½
≤
(x:_{M}/y_{F}) - z_{I}' < ½

i.e.
the quotient may be regarded as the rounded integral quotient when x:_{M}
is divided by y_{F} or when x:_{I} is divided by y_{I}.

**Function number 46 [0100 110]**

**Function number 47 [0100 111]**

Illegal instructions