Page 1 of 1

Precision of the Exponential Integral on DM42

Posted: Wed May 15, 2019 12:09 am
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:

https://keisan.casio.com/exec/system/1180573423

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?

Re: Precision of the Exponential Integral on DM42

Posted: Fri May 17, 2019 10:16 am
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