commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luc Maisonobe <Luc.Maison...@free.fr>
Subject Re: [MATH] Odd behaviour of FastMathStrictComparisonTest
Date Wed, 23 Feb 2011 14:28:11 GMT
Le 23/02/2011 15:20, Luc Maisonobe a écrit :
> Le 21/02/2011 22:18, sebb a écrit :
>> On 21 February 2011 20:03, sebb <sebbaz@gmail.com> wrote:
>>> When testing using Java 1.5.0, I am seeing the following output:
>>>
>>> Running org.apache.commons.math.util.FastMathStrictComparisonTest
>>> double atan2(1.1102230246251565E-16, -1.7976931348623157E308) expected
>>> 400921fb54442d18 actual c00921fb54442d18 entries [9, 6]
>>> double atan2(2.2250738585072014E-308, -1.7976931348623157E308)
>>> expected 400921fb54442d18 actual c00921fb54442d18 entries [11, 6]
>>> double atan2(4.9E-324, -1.7976931348623157E308) expected
>>> 400921fb54442d18 actual c00921fb54442d18 entries [13, 6]
>>>
>>> The result has the wrong sign.
>>>
>>> What is odd is that this does not happen with Java 1.6.0, nor does it
>>> happen if I try running the test on its own.
>>> Nor does it happen if use Ant to run the tests.
>>>
>>> Nor does it seem to happen in the Continuum builds, which are using Java 1.5
>>>
>>> But it happens reliably if I run "mvn test" under Java 1.5.0.
> 
> I was not able to reproduce this failure using sun java 1.5.0_22-b03 for
> AMD64 architecture on Linux. Even using -DrunOrder for surefire plugin,
> I could not change the order of the tests and RotationTest was always
> run after FastMathStrictComparisonTest (tried alphabetical,
> reversealphabetical and filesystem using "touch" to change the timestamp
> of class files).

I'm stupid. The runOrder configuration should be set in the pom, not as
a -D flag.
So putting <runOrder>alphabetical</runOrder> in the pom ensured
o.a.c.m.geometry.RotationTest was run before
o.a.c.m.util.FastMathStrictComparisonTest.

However, I was still not able to reproduce the bug.

Luc

> 
> The FastMath class does not have any state data it would store between
> calls. It is a utility class with several static final constants
> (primitive double and double arrays) that are initialized at class
> loading but never changed afterwards.
> 
>>>
>>> Very odd.
> 
> Perhaps an optimization bug in the JVM ?
> 
>>>
>>
>> I've discovered that running geometry.RotationTest before
>> FastMathStrictComparisonTest triggers the failure.
>>
>> But only in Java 1.5.0.
>>
>> Further, the test that triggers the failure is testAngles(), and the
>> specific line that causes the error is:
>>
>> double[] angles = r.getAngles(CardanOrders[i]); // line 311
>>
>> This calls various FastMath methods.
>>
>> No idea yet why the extra calls to the FastMath methods should cause a
>> subsequent call to fail.
>>
>> ---------------------------------------------------------------------
>> 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
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message