This is the mail archive of the
mauve-discuss@sources.redhat.com
mailing list for the Mauve project.
Bug in DoubleTest/FloatTest?
- From: Stephen Crawley <crawley at dstc dot edu dot au>
- To: mauve-discuss at sources dot redhat dot com
- Date: Sat, 28 Sep 2002 01:30:13 +1000
- Subject: Bug in DoubleTest/FloatTest?
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.
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.
2) Modify the subtest to accept both "0.001" and "0.0010"?
3) Remove the subtest?
4) Leave it alone.
Note: I've added these cases to open JDK Bug #4642835.
-- Steve