Calculating e^x-1 on classic HPs
01-16-2016, 01:32 PM (This post was last modified: 01-16-2016 02:02 PM by Dieter.)
Post: #35
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: Calculating e^x-1 on classic HPs
(01-16-2016 12:40 PM)Gerson W. Barbosa Wrote:  This appeared to work, but some cancellation occurs at a critical region:
(...)
What's a few ULPs among friends anyway? :-)

Or a few hundred, or a few thousand... ;-)

(01-16-2016 12:40 PM)Gerson W. Barbosa Wrote:  (...)
That should be expected by just looking at the identity I have used:

$e^{x}-1=\frac{e^{x}-e^{-x}}{e^{-x}+1}$

It works better after replacing ex – e–x with 2 sinh(x) – provided an accurate sinh function is available. I tried this on the 34s and in 100.000 random samples there were no errors beyond ±7 ULP. About 75% of the results were within ±1 ULP.

Finally I did a test run with one million random values in [ln 0.9, ln 2] with the method I suggested, and the results are essentially the same as before:

Code:
seed = 47,11   n = 1000000 ULP      #cases --------------------------  -5          12 ─── 0,001%  -4        1092 ─┐  -3         674  ├─ 0,24%  -2         676 ─┘  -1      167703 ─┐  ±0      659710  ├─ 99,5%  +1      167784 ─┘  +2         666 ─┐  +3         677  ├─ 0,23%  +4         992 ─┘  +5          14 ─── 0,001%

Again, there are two peaks at +4 and –4 ULP that also showed up in earlier tests. I wonder where these come from. Any idea?

As already mentioned, for arguments in [ln10, ln11[ or [ln100, ln101[ etc. the last digit is lost, which leads to an interesting error distribution. Here are some results for x in [ln10, ln11]:

Code:
seed = 47,11    n = 100000 ULP      #cases --------------------------  -5       4990 ─── 5%  -4      10025 ─┐  -3       9952  ├─ 30%  -2       9975 ─┘  -1      10002 ─┐  ±0      10024  ├─ 30%  +1      10170 ─┘  +2       9888 ─┐  +3       9941  ├─ 30%  +4      10042 ─┘  +5       4991 ─── 5%

As expected, the errors are evenly distributed in this interval. Again, they do not exceed ±5 ULP.

Dieter
 « 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)