Precision of the Exponential Integral on DM42

General discussion about calculators, SwissMicros or otherwise
Post Reply
Posts: 32
Joined: Sun May 06, 2018 3:45 am

Precision of the Exponential Integral on DM42

Post by gomefun2 »

I have programmed the exponential integral a couple of times and I have a problem with precision when x<-30 (on the DM42). This series is very similar to something like a Taylor series.

At x = -30 and lower the algorithm has a serious problem with precision (only a couple of sig figs or none at all). I think I know why this is:

It is because gamma (the Euler-Mascheroni constant) is 0.57721... etc and you are adding and subtracting from it numbers of vastly different sizes. At a certain point, the numbers being added and subtracted are too different in size and I'm guessing the result no longer converges properly (because the DM42 has a limit of 34-digit precision).

So my question is how do they get such good precision on this website using the exact same algorithm:

They show the equation/algorithm they used, which is the same I am using (except they have a small mistake and write a: ln(x) when it should be ln|x|).

How do they manage what seems like infinite precision on this integral?
Posts: 129
Joined: Thu Dec 21, 2017 1:23 pm

Re: Precision of the Exponential Integral on DM42

Post by whuyse »

Show us your code, please?
And that site will simply use N+k-digit arithmetic and constants to get to the precision requested (N) ie. they'll use gamma to N+k digits to guarantee the result is accurate to N digits. eg. for x=-30 the largest summation term is about 2.7e10 so an extra 10 or 11 digits will be required. On the DM42, it means you will lose that many digits.

Cheers, Werner
42S #3249S01123
DM42 #00345
DM41X #01215
Post Reply