#807 Interactions panel "returns" false for 0.0 == -0.0

2: Annoying
closed-fixed
5
2009-11-30
2009-10-19
chunkit
No

I get this:
> 0==-0.0
false
> -0.0==0.0
false
> 0.0==-0.0
false

And this:
> System.out.println(0.0==-0.0);
false
> System.out.println(-0.0==0.0);
false
> System.out.println(0==-0.0);
false

They should evaluate to true and do evaluate to true when not using the interactions panel.

DrJava build time 20090821-1520
DrJava revision 5004
java.vendor Sun Microsystems Inc.
java.version 1.6.0_16
os.name Windows XP
os.version 5.1

Thank you for looking into it.

Discussion

  • Mathias Ricken

    Mathias Ricken - 2009-10-19

    Test file for comparisons not in Interactions Pane

     
  • Mathias Ricken

    Mathias Ricken - 2009-10-19

    Interactions history making comparisons

     
  • Mathias Ricken

    Mathias Ricken - 2009-10-19
    • status: open --> open-accepted
     
  • Mathias Ricken

    Mathias Ricken - 2009-11-30

    When doing a 0.0==-0.0, ExpressionEvaluator.OBJECT_EQUAL is used, not PRIMITIVE_EQUAL. OBJECT_EQUAL does object identity.

     
  • Mathias Ricken

    Mathias Ricken - 2009-11-30

    Ignore my previous comment, it does a PRIMITIVE_EQUAL.

     
  • Mathias Ricken

    Mathias Ricken - 2009-11-30

    It is doing a Double.equals, and as per the javadoc for Double.equals, NaN equals NaN and 0.0 does not equal -0.0.

    Do we make a distinction between primitive and boxed types in Dynamic Java?

     
  • Mathias Ricken

    Mathias Ricken - 2009-11-30

    Fixed in SVN.

     
  • Mathias Ricken

    Mathias Ricken - 2009-11-30
    • assigned_to: nobody --> mgricken
    • status: open-accepted --> closed-fixed
     
  • Mathias Ricken

    Mathias Ricken - 2009-11-30

    Fixed as of revision 5138.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks