This is the mail archive of the mauve-discuss@sources.redhat.com mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bug in DoubleTest/FloatTest?


Stephen Crawley writes:
 > 
 > Folks,
 > 
 > I've found another possible bug in DoubleTest (& FloatTest).  The problem
 > shows up when I use JDK 1.3.1 and JDK 1.4.0 to run the Mauve test suite.
 > Specifically, the following subtest fails:
 > 
 >   str = Double.toString( 0.001 );
 >   if ( !Double.toString( 0.001 ).equals ("0.001" )) {
 >     harness.fail("Error: test_toString failed - 10" );
 >     System.out.println("Expected: " + "0.001");
 >     System.out.println("Got: " + Double.toString(0.001));
 >   }
 > 
 > printing out that it got "0.0010" instead of "0.001".  By contrast, 
 > the standard Classpath implementation does not fail this subtest.

Right.  The JDK has done this for a long while.

 > But it gets worse.  The JDK 1.4.0 javadoc states that toString() 
 > should output enough digits to distinguish the double from other
 > doubles ... BUT NO MORE.  In this case, the final digit of "0.0010"
 > is not necessary.  Basically, both Sun JDK implementations I tried do
 > not match the javadoc.
 > 
 > What do we do?  
 > 
 >   1)  Change the subtest to match the JDK behaviour (not the javadoc)?
 >       The implication is that Classpath should be changed to duplicate 
 >       the bug.

No.

 >   2)  Modify the subtest to accept both "0.001" and "0.0010"? 

No.

 >   3)  Remove the subtest?

No.

 >   4)  Leave it alone.

Yes: the JDK does not meet its specfication.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]