This code will do “double precision” -that is it will take two 8-digit numbers and give a 16-digit number. It accomplishes this by breaking each 8-digit number into two 4-digit numbers and then multiplying them. The products are then suitably recombined.
5 REM DOUBLE PRECISION
10 PRINT "Give first number (<=8 digits)": INPUT a: PRINT a: PRINT
20 PRINT "Give second number (<=8 digits)": INPUT b: PRINT b: PRINT
22 LET ah=INT (a/10↑4): LET al=INT (a-10↑4*ah+.1)
24 LET bh=INT (b/10↑4): LET bl=INT (b-10↑4*bh+.1)
30 LET chh=ah*bh
40 LET chl1=ah*bl
42 LET chl2=al*bh
50 LET cll=al*bl
60 LET chhh=INT (chh/10↑4): LET chhl=INT (chh-10↑4*chhh+.1)
70 LET chlh1=INT (chl1/10↑4): LET chll1=INT (chl1-10↑4*chlh1+.1)
72 LET chlh2=INT (chl2/10↑4): LET chll2=INT (chl2-10↑4*chlh2+.1)
80 LET cllh=INT (cll/10↑4): LET clll=INT (cll-10↑4*cllh+.1)
90 LET c1=10↑4*chhh+chhl+chlh1+chlh2
100 LET c2=10↑4*(chll1+chll2+cllh)+clll
102 IF c2<10↑8 THEN GO TO 110
104 LET c2=10↑4*((chll1-5000)+(chll2-5000)+cllh)+clll
106 LET c1=c1+1.
110 LET z$="0000000"
112 FOR x=1 TO 7
114 IF (c2<10↑x) THEN GO TO 122
116 NEXT x
118 PRINT c1;c2
120 STOP
122 LET w$=z$(x TO )
124 PRINT c1;w$;c2
Roald A. Schrack
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.