12-19-2014, 09:12 PM
For details please consult Wikipedia.
Program for the HP-42S:
Worked example: \(10^{10}+\pi+e\)
CLST
E10
ENTER
0
PI
XEQ "KAHAN"
1
E↑X
R/S
y: 10,000,000,005.9
x: -0.04012551795
This is the correctly rounded result.
The classic addition is not the same:
E10
PI
+
1
E↑X
+
y: 0
x: 10,000,000,005.8
Cheers
Thomas
Program for the HP-42S:
Code:
00 { 19-Byte Prgm }
01 LBL "KAHAN"
02 +
03 ENTER
04 RCL+ ST Z
05 STO- ST Z
06 X<> ST Z
07 +
08 END
Worked example: \(10^{10}+\pi+e\)
CLST
E10
ENTER
0
PI
XEQ "KAHAN"
1
E↑X
R/S
y: 10,000,000,005.9
x: -0.04012551795
This is the correctly rounded result.
The classic addition is not the same:
E10
PI
+
1
E↑X
+
y: 0
x: 10,000,000,005.8
Cheers
Thomas