Post Reply 
Calculating e^x-1 on classic HPs
01-16-2016, 12:40 PM (This post was last modified: 01-16-2016 12:42 PM by Gerson W. Barbosa.)
Post: #34
RE: Calculating e^x-1 on classic HPs
(01-16-2016 08:19 AM)Dieter Wrote:  
(01-15-2016 10:45 PM)Gerson W. Barbosa Wrote:  I'd imagined the final multiplication by x might be an issue, as you've pointed out, but in my (few) tests I didn't find significant differences compared to your results.

You'll find them after a few hundred thousand samples. ;-)

In post #20 I provided a table with the error distribution in ULPs. I have updated this table to show differences up to 9 ULP which occured with my implementation of the Kahan method.


Code:

01- ENTER
02- e^x
03- ENTER
04- 1/x
05- -
06- x=0
07- GTO 15
08- x<>y
09- CLx
10- LSTx
11- 1
12- +
13- /
14- x<>y
15- Rv
16- GTO 00

This appeared to work, but some cancellation occurs at a critical region:

+1E+0 -> +1.718281829E+0 (+1.718281828E+0) 0001 ULP
+1E-1 -> +1.051709180E-1 (+1.051709181E-1) 0001 ULP
+1E-2 -> +1.005016702E-2 (+1.005016708E-2) 0006 ULP
+1E-3 -> +1.000500000E-3 (+1.000500167E-3) 0167 ULP !
+1E-4 -> +1.000050000E-4 (+1.000050002E-4) 0002 ULP
+1E-5 -> +1.000000000E-5 (+1.000005000E-5) 5000 ULP !
+1E-6 -> +1.000000500E-6 (+1.000000050E-6) 0000 ULP

-1E+0 -> -6.321205588E-1 (-6.321205588E-1) 0000 ULP
-1E-1 -> -9.516258195E-2 (-9.516258196E-2) 0001 ULP
-1E-2 -> -9.950166234E-3 (-9.950166251E-3) 0017 ULP !
-1E-3 -> -9.995001001E-4 (-9.995001666E-4) 0665 ULP !
-1E-4 -> -9.999500001E-5 (-9.999500017E-5) 0016 ULP !
-1E-5 -> -9.999950000E-6 (-9.999950000E-6) 0000 ULP
-1E-6 -> -9.999995000E-7 (-9.999995000E-6) 0000 ULP


What's a few ULPs among friends anyway? :-)

At least it gets those right:

+9E-09 -> +9.000000041E-09 (+9.000000041E-09) 0000 ULP
+5E-11 -> +5.000000000E-11 (+5.000000000E-11) 0000 ULP

That should be expected by just looking at the identity I have used:

\[e^{x}-1=\frac{e^{x}-e^{-x}}{e^{-x}+1}\]

This resembles a bit the HP-35S trigonometry bug.

Gerson.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Calculating e^x-1 on classic HPs - Dieter - 01-11-2016, 10:20 PM
RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-16-2016 12:40 PM



User(s) browsing this thread: 9 Guest(s)