Bug 22708 - java.awt.geom.QuadCurve2D.solveQuadratic sometimes gives wrong result
Summary: java.awt.geom.QuadCurve2D.solveQuadratic sometimes gives wrong result
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: unspecified
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-21 14:27 UTC by from-classpath
Modified: 2005-07-23 22:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description from-classpath 2003-10-21 14:27:36 UTC
The solveQuadratic method in java.awt.geom.QuadCurve2D gives the wrong result for the equation 4 * (x^2) = 0. This equation has exactly one solution, namely x = 0.

Both Sun J2SE 1.4.1_01 (GNU/Linux i386) and Apple JDK 1.3.1 (PowerPC G4) return the correct result. GNU Classpath however claims that the equation has two solutions.

A Mauve test case is attached, see checks 8 and 9.
Comment 1 from-classpath 2003-10-24 14:06:57 UTC
This would be fixed by a revised version of solveQuadratic that is derived from the GNU Scientific Library (GSL). Since GSL is licensed under the GPL, but not (c) FSF, we'll have to ask the GSL authors for permission. I've sent an e-mail to the author today, with cc to Mark Wielaard. If the GSL author agrees, I'll check in my patch.

A revised version of the test case is now in Mauve cvs.
Comment 2 from-classpath 2004-01-05 00:34:41 UTC
Fixed by revision 1.10 of java/awt/geom/QuadCurve2D.java, checked in today. Also, revision 1.6 of java/awt/CubicCurve2D.java now has a numerically stable implementation of cubic equation solving. The author of the relevant code in the GNU Scientific Library has assigned copyright to the FSF.