How to approximate $\text{li}(z)$ numerically? I'm trying to implement a function to calculate $\pi(x)$ via Riemann's formula:
$$
\pi(x) = \operatorname{R}(x^1) - \sum_{\rho}\operatorname{R}(x^{\rho}) - \frac1{\ln x} + \frac1\pi \arctan \frac\pi{\ln x} ,
$$
with $    \operatorname{R}(x) = \sum_{n=1}^{\infty} \frac{ \mu (n)}{n} \operatorname{li}(x^{1/n})$, the sum runs over the non-trivial roots of $\zeta$ and $\text{li}(z)$ being the logarithmic integral.
The problem is that I don't have function to calculate $\text{li}(z)$.
Since I'm not familiar with complex limits I'm not sure if I can write it as a simple sum.
Thanks for your help,
BTW, my result for $x=100,n_{max}=1$ and only one root of $\zeta$ is $30.2748$. Can anyone crosscheck that?
 A: Ok I found this very nice paper:

$\phantom{somespace}$On the Evaluation of the Complex-ValuedExponential Integral 
by Vincent Pegoraro and Philipp Slusallek
  Saarland University:
Abstract. Although its applications span a broad scope of scientific fields ranging
  from applied physics to computer graphics, the exponential integral is a nonelementary
  special function available in specialized software packages but not in standard
  libraries, consequently requiring custom implementations on most platforms. In
  this paper, we provide a concise and comprehensive description of how to evaluate
  the complex-valued exponential integral. We first introduce some theoretical background
  on the main characteristics of the function, and outline available third-party
  proprietary implementations. We then provide an analysis of the various known
  representations of the function and present an effective algorithm allowing the computation
  of results within a desired accuracy, together with the corresponding pseudocode
  in order to facilitate portability onto various systems. An application to
  the calculation of the closed-form solution to single light scattering in homogeneous
  participating media illustrates the practical benefits of the provided implementation
  with the hope that, in the long term, the latter will contribute to standardizing the
  availability of the complex-valued exponential integral on graphics platforms.
  CCS: G.1.2 [Numerical Analysis]: Approximation – Special function approximations

They put pseudocodes for all approximations there, which are really close to an implementation.
