Re: pow() problem
From: Tom St Denis (tomstdenis_at_gmail.com)
Date: 02/23/05
- Next message: ben: "Re: number of machine instructions - for algorithm measuring"
- Previous message: Dave Vandervies: "Re: is this stadard C?"
- In reply to: Eric Sosman: "Re: pow() problem"
- Next in thread: Eric Sosman: "Re: pow() problem"
- Reply: Eric Sosman: "Re: pow() problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 23 Feb 2005 08:50:30 -0800
Eric Sosman wrote:
> Tom St Denis wrote:
> > [...]
> > That's nonsense. pow is normally implemented as
> >
> > pow(a, b) = exp(ln(a) * b)
>
> (Slight topic drift): For suitable values of "normally,"
> with implications of "quick and dirty." This is not a very
> accurate implementation of pow(), and I wouldn't expect to
> find it in a high-quality math library. Reference: "The
> Standard C Library" by P.J. Plauger gives a brief but quite
> understandable explanation of the problems and exhibits an
> implementation that mitigates them.
pow(a, b) = exp(ln(a) * b)
is EXACTLY correct.
... however as implemented [and executed] it may not be ideal. The
"crux" of what the pow function does is probably along the lines of the
equivalence since you can easily find exp and ln from two convergent
series.
Tom
- Next message: ben: "Re: number of machine instructions - for algorithm measuring"
- Previous message: Dave Vandervies: "Re: is this stadard C?"
- In reply to: Eric Sosman: "Re: pow() problem"
- Next in thread: Eric Sosman: "Re: pow() problem"
- Reply: Eric Sosman: "Re: pow() problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|