(I originally asked this in a different exchange.)
I'm writing a program that uses the prime-counting function. Right now, I'm using
x/log(x), but I want to switch to something more accurate. A better approximation is the logarithmic integral function (actually, its Eulerian variant), which can be computed from the exponential integral. Now how can I compute the exponential integral? I'm on a macOS Intel system using Swift, so I can use the various advanced floating-point functions provided by Apple's system libraries if needed to help.
I did see a similar question, but I use a different domain (2 and above).
Of course, answers that involve a function better than
Li(x) are acceptable too, as long as I can implement them easily.