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

java.lang.Bignum.modExp() method works wrong

XMLWordPrintable

    • 1.1
    • sparc
    • solaris_2.5
    • Not verified

      It should return "this"^"exponent" mod "mod" but may throw an exception
      ==== Here is the minimized test demonstrating the bug ====
      import java.lang.Bignum;
      class java_lang_Bignum_modExp {
        public static void main(String args[]) {
           Bignum b1=new Bignum(100);
           Bignum b2=new Bignum(".5");
           Bignum b3=new Bignum(2);
           System.out.println(b1.modExp(b2,b3)); // should print "0"
        }
      }
      ==== Here is the test output ====
      java.lang.ArrayIndexOutOfBoundsException: -1
      at java.lang.Bignum.mul0(Bignum.java)
      at java.lang.Bignum.modExp(Bignum.java)
      at java_lang_Bignum_modExp.main(java_lang_Bignum_modExp.java:7)

            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: