Skip to main content
3 of 4
added 9 characters in body
Carlo Beenakker
  • 188.1k
  • 18
  • 448
  • 651

Since $\ln x = - \ln(1/x)$, to evaluate the logarithm near zero is equivalent to evaluating it for large argument. You can then use the result $$\ln y=\frac{\pi}{2a}\left(1+{\cal O}(y^{-2})\right),$$ with $a$ the arithmetic–geometric mean$^\ast$ of $a_0=1$ and $b_0=4/y$, see page 11 of Multiple-precision zero-finding methods and the complexity of elementary function evaluation.

$^\ast$ Starting from any two positive numbers $a_0$ and $b_0$, the arithmetic-geometric-mean iterate is $a_{i+1} = (a_i + b_i)/2$, $b_{i+1} = 􏰇\sqrt{a_ib_i}$. For $a_0\gg b_0$ this converges rapidly to $a=\lim_{i\rightarrow\infty} a_i$.
Carlo Beenakker
  • 188.1k
  • 18
  • 448
  • 651