commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <stei...@yahoo.com>
Subject RE: [math] Math.pow usage was: Re: cvs commit: ...
Date Thu, 19 Jun 2003 15:09:12 GMT

--- Brent Worden <brent@worden.org> wrote:
> >
> > I am also a little confused by J's analysis. Do we know
> > definitively that using
> > J2SE, there is precision loss in Math.pow(x,n) vs x*x*...*x (n
> > terms) for small
> > integer n?  If the answer is yes, we should establish the
> > guideline that for
> > integer n < 4, we use explicit products instead of Math.pow(-,n).
> >
> > Phil
> 
> According to the J2SE javadoc, the math methods use fdlibm
> (http://www.netlib.org/fdlibm/) for their implementations.  Here's the pow
> implementation http://www.netlib.org/fdlibm/e_pow.c.  According to its
> comments, its only perfectly accurate for the two integer argument case.
> Otherwise it's "nearly rounded."
> 

Thanks for doing the research, Brent.  Based on this, I propose that we
establish the guideline above -- i.e., avoid Math.pow(x,n) for (constant)
integer n < 4 and floating point x.  I will submit a patch to developer.xml
including this.

Phil

> Brent Worden
> http://www.brent.worden.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message