"Tim Peters" <[EMAIL PROTECTED]> wrote:
>
> One low-effort approach is to use a general root-finding algorithm and
> build ln(x) on top of exp() via (numerically) solving the equation
> exp(ln(x)) == x for ln(x).  ...

Not a general one, please!  At least use one that assumes the continuity
of second derivatives :-)

> However, the IBM spec requires < 1 ULP worst-case error, and that may
> be unreasonably hard to meet with a root-finding approach.  ...

It's a doddle in a software implementation for civilised functions
like log.  All you do is to do the calculation in a sufficiently
extended precision - and you can work that out in advance for very
little extra effort.  Then you round to the result - and, hey! Bob's
your uncle!  0.501 ULPs is as easy as 1, if a bit slower.

Now, doing that for the power function is a right royal pain in the
neck, and you really DON'T want to even contemplate a generic gamma
function, let alone one of the beta functions :-(  But none of this
is specific to a decimal base, of course.


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email:  [EMAIL PROTECTED]
Tel.:  +44 1223 334761    Fax:  +44 1223 334679
_______________________________________________
Python-Dev mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to