No, the patch does not work. However, the following code does seem to work for me on both 1.5 and 1.6
if (ra == 0) { // Fix up the sign so atan works correctly ra = copySign(0.0, y); } i.e. always copy the sign of y, not just when negative. > Please, could one of those who see the bug check if the following patch fixes > it or not ? > > Thanks > Luc > > > =================================================================== > --- src/main/java/org/apache/commons/math/util/FastMath.java (révision > 1073250) > +++ src/main/java/org/apache/commons/math/util/FastMath.java (copie de > travail) > @@ -3046,8 +3046,8 @@ > rb = -(temp - ra - rb); > ra = temp; > > - if (ra == 0 && (y < 0)) { // Fix up the sign so atan works correctly > - ra = -0.0; > + if (ra == 0) { // Fix up the sign so atan works correctly > + ra = copySign(0.0, y); > } > > // Call atan > > > > > > ----- "luc maisonobe" <luc.maison...@free.fr> a écrit : > >> ----- "Oliver Heger" <oliver.he...@oliver-heger.de> a écrit : >> >> > Am 23.02.2011 21:08, schrieb Luc Maisonobe: >> > > Le 23/02/2011 20:35, Simone Tripodi a écrit : >> > >> I wonder if the cause of the fails on my runs could be an >> Apple's >> > JVM bug... >> > >> Any idea? >> > > >> > > I think Sebastian encountered this bug with Windows XP. >> > > >> > > Luc >> > >> > I see the same problem on Windows 7 and JDK 1.5: >> > >> > Results : >> > >> > Failed tests: >> > >> > test1[3](org.apache.commons.math.util.FastMathStrictComparisonTest) >> > >> > Tests run: 2451, Failures: 1, Errors: 0, Skipped: 1 >> > >> > Here is my setup: >> > Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200) >> > Java version: 1.5.0_21 >> > Java home: C:\Program Files\Java\jdk1.5.0_21\jre >> > Default locale: de_DE, platform encoding: Cp1252 >> > OS name: "windows 7" version: "6.1" arch: "x86" Family: "windows" >> > >> > With JDK 1.6 I can build successfully. So it seems to be a JDK >> > issue(?). >> >> I think so. >> One should also be aware that the error is at a discontinuity. >> Basically, this test computes atan2(y, x) with y being almost 0 >> (slightly positive) and x being a very large negative number. If y was >> exactly 0 and x was exactly NEGATIVE_INFINITY, then the correct result >> would be either +PI or -PI. Here, due to the signs of x and y, the >> result should be +PI and it is -PI which is the same modulo 2PI. >> >> So it is not a completely absurd result. >> >> Luc >> >> > >> > Oliver >> > >> > > >> > >> Simo >> > >> >> > >> http://people.apache.org/~simonetripodi/ >> > >> http://www.99soft.org/ >> > >> >> > >> >> > >> >> > >> On Wed, Feb 23, 2011 at 7:03 PM, Jörg >> > Schaible<joerg.schai...@gmx.de> wrote: >> > >>> Hi Luc, >> > >>> >> > >>> Luc Maisonobe wrote: >> > >>> >> > >>>> Tag: >> > >>>> >> > >> http://svn.apache.org/repos/asf/commons/proper/math/tags/MATH_2_2_RC3/ >> > >>>> >> > >>>> Distributions: http://people.apache.org/~luc/math-2.2-RC3/ >> > >>>> >> > >>>> Maven artifacts: >> > http://people.apache.org/~luc/math-2.2-RC3/maven/ >> > >>>> >> > >>>> Documentation bundled with the binary distribution: >> > >>>> http://people.apache.org/~luc/math-2.2-RC3/docs/ >> > >>>> >> > >>>> Output of maven:site run against the source distribution: >> > >>>> http://people.apache.org/~luc/math-2.2-RC3/site/ >> > >>>> >> > >>>> Clirr report: >> > >>>> >> > http://people.apache.org/~luc/math-2.2-RC3/site/clirr-report.html >> > >>>> >> > >>>> Release notes: >> > >>>> http://people.apache.org/~luc/math-2.2-RC3/RELEASE-NOTES.txt >> > >>>> >> > >>>> Votes, please. This vote will close in 72 hours, >> > 2011-02-26T12:00:00 UTC >> > >>>> >> > >>>> [ ] +1 Release these artifacts >> > >>>> [ ] +0 OK, but... >> > >>>> [ ] -0 OK, but really should fix... >> > >>>> [ ] -1 I oppose this release because... >> > >>> >> > >>> +1 >> > >>> >> > >>> I've tested the source distribution and can build and run all >> > tests >> > >>> flawlessly with M3 using Sun JDK 1.5 + 1.6, IMB JDK 1.5 + 1.6 >> and >> > OpenJDK >> > >>> 1.6. However, I am running also on Linux/AMD64 architecture. >> > >>> >> > >>> Cheers, >> > >>> Jörg >> > >>> >> > >>> >> > >>> >> > >> --------------------------------------------------------------------- >> > >>> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org >> > >>> For additional commands, e-mail: dev-h...@commons.apache.org >> > >>> >> > >>> >> > >> >> > >> >> > >> --------------------------------------------------------------------- >> > >> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org >> > >> For additional commands, e-mail: dev-h...@commons.apache.org >> > >> >> > > >> > > >> > > >> > >> --------------------------------------------------------------------- >> > > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org >> > > For additional commands, e-mail: dev-h...@commons.apache.org >> > > >> > >> > >> > >> --------------------------------------------------------------------- >> > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org >> > For additional commands, e-mail: dev-h...@commons.apache.org >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org >> For additional commands, e-mail: dev-h...@commons.apache.org > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org