Multiplication Accuracy with the ZX81

See all articles from Sinc-Link v8 n5
Author(s): George Chambers
Publication: Sinc-Link
Pub Details: Sinc-Link v8 n5 (Volume 8, Issue 5)
Date: September/October 1990
Pages: 9

As the Sinclair manual states, the ZX81 can multiply with an 8-digit accuracy.

The following program will allow you to multiply two integers of any (practical) length with absolute accuracy.

30 INPUT X$
40 INPUT Y$
50 DIM A( LEN X$ + LEN Y$)
60 FOR M = LEN X$ TO 1 STEP-1
70 FOR M = LEN Y$ TO 1 STEP -1
80 LET C = M + N
90 LET B + JAL X$(M)
100 LET A(C) = VAL Y$(N) * B + A(C)
110 LET I = INT A(C) - (I * 10)
120 LET A(C) = A(C) - (I * 10)
130 LET A(C-1) = A(C-1) + I
140 NEXT N
150 NEXT M
160 CLS
170 PRINT X$; "X"; Y$; " = ";
180 PRINT
190 FOR P = 2 TO (LEN X$ + LEN Y$)
200 PRINT A(P)
210 NEXT P
220 STOP

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.