commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Neidhart <thomas.neidh...@gmail.com>
Subject Re: [math] Test failures after switch to Java 1.7
Date Wed, 25 Feb 2015 09:40:14 GMT
I wonder if in this case the problem is related to branch prediction or
instruction re-ordering.

The FastMath.pow() method has a lot of ifs to handle special cases, but
they are all independent and and handled in sequence. No results are
calculated or stored in them, so the JVM might wrongly assume that it can
safely re-order them in a more efficient way.

I will try to express the special cases using if / else instead and run a
test to see if this changes the result.


On Wed, Feb 25, 2015 at 3:09 AM, sebb <sebbaz@gmail.com> wrote:

> Might be worth running a version of the test with JIT disabled.
> This will make the test much longer so I suggest first seeing if the
> tests fail on their own, and then disable JIT.
> You could experiment with the additional Jenkins Math job I set up for
> the H10 tests:
>
> https://builds.apache.org/job/Commons%20Math%20H10/
>
> On 24 February 2015 at 19:56, Thomas Neidhart <thomas.neidhart@gmail.com>
> wrote:
> > Hi,
> >
> > after switching to Java 1.7 there seems to be another problem with
> > FastMath, see the two test failures below when running on jenkins.
> >
> > Can somebody reproduce it on a 64 bit machine (I just have a 32 bit
> > laptop at home)?
> >
> > Test setup: Java 7 latest (1.7.0_75?), maven 3.1.1.
> >
> > Tests run: 65, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 13.332
> > sec <<< FAILURE! - in org.apache.commons.math4.util.FastMathTest
> > testPowSpecialCases(org.apache.commons.math4.util.FastMathTest)  Time
> > elapsed: 0.007 sec  <<< FAILURE!
> > java.lang.AssertionError: pow(0.5, Infinity) should be 0.0
> > expected:<0.0> but was:<Infinity>
> >         at org.junit.Assert.fail(Assert.java:88)
> >         at org.junit.Assert.failNotEquals(Assert.java:743)
> >         at org.junit.Assert.assertEquals(Assert.java:494)
> >         at
> >
> org.apache.commons.math4.util.FastMathTest.testPowSpecialCases(FastMathTest.java:372)
> >
> > Running org.apache.commons.math4.util.FastMathStrictComparisonTest
> > Tests run: 53, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.037
> > sec <<< FAILURE! - in
> > org.apache.commons.math4.util.FastMathStrictComparisonTest
> > test1[37](org.apache.commons.math4.util.FastMathStrictComparisonTest)
> > Time elapsed: 0 sec  <<< FAILURE!
> > java.lang.AssertionError: double pow(-0.0, NaN) expected NaN actual
> > -Infinity entries [1, 3]
> >         at org.junit.Assert.fail(Assert.java:88)
> >         at
> >
> org.apache.commons.math4.util.FastMathStrictComparisonTest.reportFailedResults(FastMathStrictComparisonTest.java:158)
> >         at
> >
> org.apache.commons.math4.util.FastMathStrictComparisonTest.callMethods(FastMathStrictComparisonTest.java:182)
> >         at
> >
> org.apache.commons.math4.util.FastMathStrictComparisonTest.setupMethodCall(FastMathStrictComparisonTest.java:204)
> >         at
> >
> org.apache.commons.math4.util.FastMathStrictComparisonTest.test1(FastMathStrictComparisonTest.java:92)
> >
> > Thomas
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message