Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4012620

java.lang.Bignum object may have value "-0" which isn't equal to "0"

XMLWordPrintable

    • 1.1
    • sparc
    • solaris_2.5
    • Not verified

      Specification does not say that Bignum may have value "-0".
      It can be created by the constructor or achieved as the result of
      operation (eg -1*0).
      Class Bignum declares only one constant ZERO.

      === Here is the minimized test demonstrating the bug ===
      import java.lang.Bignum;
      class java_lang_Bignum_equals {
        public static void main(String args[]) {
          Bignum b1=new Bignum("-0");
          Bignum b2=new Bignum("0");
          System.out.println(b1.equals(b2));
        }
      }
      === Here is the output of the test ===
      false

            mhapnersunw Mark Hapner (Inactive)
            mgorshen Mikhail Gorshenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: