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

java.lang.Bignum.pow() methods works wrong with non-integral or negative numbers

XMLWordPrintable

    • 1.1
    • sparc
    • solaris_2.5
    • Not verified

      Decimal point position in result is wrong for non-integral numbers.
      Sign is wrong for negative numbers.
      ==== Here is the minimized test demonstrating the bug ====
      class java_lang_Bignum_pow {
        public static void main(String args[]) {
          Bignum b1=new Bignum("2.0");
          Bignum b2=new Bignum("-2");
          System.out.println(b1.pow(2)); //should print "4.0"
          System.out.println(b2.pow(2)); //should print "4"
        }
      }
      ==== Here is the test output ====
      40.0
      -4

            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: