04-14-2020, 08:38 AM
works in all flavors of the 42, mainly as test cases for Thomas' FMA-rewrite of all internal DOT functions. For the 42S, change all LSTO instructions to STO.
It works using subroutines that will:
- add two single-precision numbers and produce a double-precision number (S+)
- multiply two single-precision numbers and produce a double-precision number (Sx)
- add two double-precision numbers (D+)
These routines are bundled in the file double.raw
I've added my notes on these, for those who want more details.
The double precision summation and DOT functions are in SUMDOT.raw. They will return double-precision numbers (heads in Y, tails in X)
listings:
Cheers, Werner
It works using subroutines that will:
- add two single-precision numbers and produce a double-precision number (S+)
- multiply two single-precision numbers and produce a double-precision number (Sx)
- add two double-precision numbers (D+)
These routines are bundled in the file double.raw
I've added my notes on these, for those who want more details.
The double precision summation and DOT functions are in SUMDOT.raw. They will return double-precision numbers (heads in Y, tails in X)
listings:
Code:
00 { 93-Byte Prgm }
01▸LBL "Σ"
02 EDIT
03 ABS
04 CLST
05 LASTX
06▸LBL 10
07 0
08 XEQ "D+"
09 J+
10 RCLEL
11 FC? 77
12 GTO 10
13 EXITALL
14 CLX
15 +
16 RTN
17▸LBL "DOT2"
18 LSTO "REGS"
19 R↓
20 EDIT
21 CLST
22 LSTO "S"
23 LSTO "I"
24▸LBL 11
25 COMPLEX
26 STO "S"
27 RCLEL
28 RCL IND "I"
29 XEQ "S×"
30 RCL "S"
31 COMPLEX
32 XEQ "D+"
33 J+
34 ISG "I"
35 X<>Y
36 FC? 77
37 GTO 11
38 RCLEL
39 EXITALL
40 R↓
41 END
Code:
00 { 154-Byte Prgm }
01▸LBL "D-"
02 +/-
03 X<>Y
04 +/-
05 X<>Y
06▸LBL "D+"
07 X<> ST T
08 XEQ "S+"
09 X<>Y
10 R↓
11 +
12 +
13▸LBL "Q+"
14 X<>Y
15 RCL+ ST Y
16 STO- ST L
17 X<>Y
18 RCL+ ST L
19 RTN
20▸LBL "S+"
21 LSTO "."
22 RCL+ ST Y
23 RCL- ST Y
24 STO- "."
25 X<> ST L
26 STO- ST L
27 X<>Y
28 RCL+ ST L
29 RCL+ "."
30 RTN
31▸LBL "S×"
32 RCL× ST Y
33 LSTO "."
34 LASTX
35 XEQ 99
36 R↑
37 XEQ 99
38 RCL× ST Z
39 R↑
40 RCL× ST L
41 R↓
42 R↓
43 STO× ST Y
44 RCL× ST L
45 RCL- "."
46 +
47 +
48 +
49 RCL "."
50 X<>Y
51 RTN
52▸LBL 99
53 100000000000000001
54 ABS
55 R↓
56 ENTER
57 RCL× ST L
58 STO- ST L
59 RCL+ ST L
60 X<>Y
61 RCL- ST Y
62 END
Cheers, Werner