Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Aug 2012 12:37:16 -0500
From:      Stephen Montgomery-Smith <stephen@missouri.edu>
To:        freebsd-numerics@freebsd.org
Subject:   Status of expl logl
Message-ID:  <502A8CCC.5080606@missouri.edu>

next in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?502A8CCC.5080606>