Sascha Brawer writes:
 > ---------------- Begin Forwarded Message ----------------
 > Subject: Re: Quadratic and cubic equations
 > Date Sent: Wednesday, January 7, 2004 3:17 PM
 > From: Sascha Brawer <[EMAIL PROTECTED]>
 > To: Brian Gough <[EMAIL PROTECTED]>
 > CC: Mark Wielaard <[EMAIL PROTECTED]>, Michael Koch <[EMAIL PROTECTED]>
 > 
 > Hi Brian
 > 
 > we have a problem with solving a specific quadratic equation in GNU
 > Classpath. For your convenience, I've re-written the problematic equation
 > as a patch to the GSL test suite (gsl/poly/test.c); see below.
 > 
 > I suspect that the problem is the test for (disc == 0) in gsl/poly/
 > solve_quadratic.c, line 61. With the Java version of your code, we get a
 > very small negative number in gcj (the Java front-end for the GCC) on IA-
 > 32, and exactly 0.0 with some other Java Virtual Machines.
 > 
 > Could it be that the test for (disc == 0) should actually be replaced by
 > something like (fabs(disc - 0.0) < EPSILON)? If so, which value is
 > appropriate for EPSILON?

I don't think so, no.  The problem is that 0.1 cannot be represented
exactly, so it's a matter of whether the discriminant ends up being a
very small positive number, a small negative number, or zero.
solveQuadratic isn't wrong: its argument is.

It looks to me like this is a test of exact java strictfp compliance.
gcj fails, because it isn't strictfp compliant.

Andrew.


_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to