commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brent Worden" <>
Subject Re: [math] Priorities, help needed
Date Fri, 23 May 2003 06:39:57 GMT
The exp(log()) technique is almost always more numerically accurate because
log() significantly reduces the magnitude of large numbers.  Thus, reducing
the chance of significant digit loss when adding.  Also, since the log()
values are smaller there is less chance of numerical overflow with large
data sets.

Another approach I've used to reduce numerical overflow and numerical error
is by employing induction (e.g. recursive) formulas.  For instance, the mean
of n numbers can easily be computed from the mean of the first n-1 numbers
and the n-th number.  Knuth's "The Art of Programming" describes this
formula and attests to its numerical accuracy.  I think one could derive a
induction formula for geometric mean that would exhibit similar numerical

Brent Worden

"Mark R. Diggory" <> wrote in message
> Phil Steitz wrote:
> >Yes.  The computation is easy.  The question is is it a)
> >more efficient and/or b) more accurate.  That is what we
> >need to find out.
> >
> >
> Details I've seen thus far describe it as more efficient to use the log
> approach. I think your points about accuracy and rounding are strong as
> well.
> It really depends on the java.lang.Math approach to log() and exp().
> Both these methods deligate to a native C implimentations deep in JVM.
> Just some links through Google
> -Mark

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message