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

java.lang.Bignum.doubleValue, floatValue methods work wrong with large values

XMLWordPrintable

    • sparc
    • solaris_2.5

      ==== Here is the minimized test demonstrating the bug ====
      import java.lang.Bignum;
      class java_lang_Bignum_floatValue {
        public static void main(String args[]) {
          Bignum b=new Bignum(Float.MAX_VALUE, 0);
          System.out.println("b = " + b);
          System.out.println("b.floatValue() = " + b.floatValue());
          System.out.println("b.doubleValue() = " + b.doubleValue());
        }
      }
      ==== Here is the output of the test ===
      b = 340282346638528860000000000000000000000
      b.floatValue() = 7.421703E+15
      b.doubleValue() = 7.421703038235E+15

            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: