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
 Gerson W. Barbosa Senior Member Posts: 1,452 Joined: Dec 2013
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.
 « Next Oldest | Next Newest »

 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 - Thomas Klemm - 01-12-2016, 01:41 AM RE: Calculating e^x-1 on classic HPs - Dieter - 01-12-2016, 06:12 PM RE: Calculating e^x-1 on classic HPs - Claudio L. - 01-12-2016, 05:13 AM RE: Calculating e^x-1 on classic HPs - Dieter - 01-12-2016, 02:02 PM RE: Calculating e^x-1 on classic HPs - ElectroDuende - 01-12-2016, 03:34 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-12-2016, 06:30 PM RE: Calculating e^x-1 on classic HPs - Claudio L. - 01-12-2016, 09:44 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-12-2016, 08:16 PM RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-13-2016, 03:46 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-13-2016, 06:43 PM RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-14-2016, 02:47 AM RE: Calculating e^x-1 on classic HPs - Dieter - 01-14-2016, 01:44 PM RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-14-2016, 03:30 PM RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-14-2016, 06:50 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-14-2016, 07:38 PM RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-14-2016, 07:50 PM RE: Calculating e^x-1 on classic HPs - Albert Chan - 02-02-2019, 07:32 PM RE: Calculating e^x-1 on classic HPs - Dieter - 02-03-2019, 06:46 PM RE: Calculating e^x-1 on classic HPs - Paul Dale - 01-14-2016, 07:20 AM RE: Calculating e^x-1 on classic HPs - Dieter - 01-14-2016, 01:48 PM RE: Calculating e^x-1 on classic HPs - emece67 - 01-14-2016, 03:55 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-14-2016, 06:42 PM RE: Calculating e^x-1 on classic HPs - emece67 - 01-14-2016, 09:14 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-14-2016, 09:55 PM RE: Calculating e^x-1 on classic HPs - Paul Dale - 01-15-2016, 01:19 AM RE: Calculating e^x-1 on classic HPs - Dieter - 01-15-2016, 02:00 PM RE: Calculating e^x-1 on classic HPs - matthiaspaul - 01-15-2016, 10:10 AM RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-15-2016, 06:07 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-15-2016, 06:46 PM RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-15-2016, 10:45 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-16-2016, 08:19 AM RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-16-2016 12:40 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-16-2016, 01:32 PM RE: Calculating e^x-1 on classic HPs - Albert Chan - 02-02-2019, 07:22 PM RE: Calculating e^x-1 on classic HPs - Paul Dale - 01-14-2016, 09:22 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-14-2016, 09:49 PM RE: Calculating e^x-1 on classic HPs - Albert Chan - 02-26-2021, 03:00 PM RE: Calculating e^x-1 on classic HPs - Albert Chan - 03-01-2021, 02:23 PM RE: Calculating e^x-1 on classic HPs - Paul Dale - 01-15-2016, 01:15 AM RE: Calculating e^x-1 on classic HPs - Albert Chan - 02-03-2019, 08:28 PM RE: Calculating e^x-1 on classic HPs - Albert Chan - 02-04-2019, 07:28 PM RE: Calculating e^x-1 on classic HPs - Dieter - 02-04-2019, 07:59 PM

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