http://www.hpmuseum.org/forum/printthread.php?tid=2668
![]() |
Kahan summation algorithm – Printable Version
+- HP Forums (http://www.hpmuseum.org/forum) |
Kahan summation algorithm – Thomas Klemm – 12-19-2014 10:12 PM For details please consult Wikipedia. Program for the HP-42S: Code:
00 { 19-Byte Prgm } Worked example: \(10^{10}+\pi+e\) CLST y: 10,000,000,005.9 This is the correctly rounded result. The classic addition is not the same: E10 y: 0 Cheers RE: Kahan summation algorithm – Gerald H – 12-20-2014 10:47 AM Thank you. Never seen this before. RE: Kahan summation algorithm – Werner – 12-21-2014 09:52 AM What I have never seen mentioned is the fact that this algorithm is meant for binary floating point. Try adding x=y= 1e12-2 BTW my version reads: Code:
*LBL "K+" same size. Werner |