Status of expl logl

Stephen Montgomery-Smith stephen at missouri.edu
Tue Aug 14 17:37:19 UTC 2012


Are people working on expl, logl and log1pl?



I was trying to brainstorm ideas.  If one had an expl, one could create 
a logl as follows:

long double logl(long double x)
{
   long double y;

   y = log(x);
   y -= 1 - x*expl(-y);
}

Of course you would need prechecks to make sure log(x) doesn't overflow, 
etc.

But my thinking is this.  Use log(x) as a starting value for Newton's 
Method.  Since Newton's Method roughly doubles the number digits of 
precision, only one iteration is needed.

It doesn't work so well if 1/e < x < e.

Anyway, just throwing out an idea.



Also, I came across this algorithm:

http://en.wikipedia.org/wiki/Logarithm#Arithmetic-geometric_mean_approximation

It does need a few extra bits of precision than you want in the final 
answer.  But it is used by mpfr, and it is surprisingly fast.


More information about the freebsd-numerics mailing list