--- Brent Worden <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
