[Kaffe] Double related bug found!

Moses DeJong dejong at cs.umn.edu
Sat May 29 12:43:54 PDT 1999


Hi all.

Kaffe seems to have a bug related to the parsing and printing
of Double values out of a string and the equals() method.
A leading '-' is not taken into account. Here is a simple
test case that shows the problem. Also see the Java spec
section 15.19.1 for related info.


public class Zero {
    public static  double zero = -0.0;
    public static  double myarray[] = { -0.0, 0.0, +0.0};
    public String printmyarray() {
        return  "zero=" + zero + " myarray=" + myarray[0] + " " +
                myarray[1] + " " +
                myarray[2];
    }
    public static void main(String argv[]) {
        Zero z1 = new Zero();
        System.out.println(z1.printmyarray());

        Double z2 = new Double("-0.0");
        System.out.println(z2.doubleValue());
        System.out.println(zero);
        System.out.println(z2.equals(new Double(zero)));
    }
}



(On a Sun system with JDK 1.1.6)

% java Zero
zero=-0.0 myarray=-0.0 0.0 0.0
-0.0
-0.0
true

(On a Sun box with Kaffe from the CVS on Sat May 29)

% kaffe Zero
zero=0.0 myarray=0.0 0.0 0.0
-0.0
0.0
false


I do not have time to track this bug down right now so
perhaps someone else will want to look into it.


I hope that helps
Mo DeJong
dejong at cs.umn.edu




More information about the kaffe mailing list