Skip to main content
1 of 4
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 A-G mean iterate$^\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$, we may iterate as follows: $a_{i+1} = (a_i + b_i)/2$, $b_{i+1} = 􏰇\sqrt{a_ib_i}$, and then $a=\lim_{i\rightarrow\infty} a_i$.
Carlo Beenakker
  • 188.1k
  • 18
  • 448
  • 651