Attached is the code for regression test for multiply() and pow() in
BigInteger.  It produces a lot of text (approximately 345 MB) to
standard output.  You will need to save this output and diff it against
known good results.  I have provided a file of known good results tested
against a variety of platforms, including the Kaffe JVM using the GMP
libraries for BigInteger.

   It tests a lot of different size arguments, including arguments
around many powers of 2, which are the places that one would expect
problems to occur.

   The known good results are available at:
   http://futureboy.us/temp/BigIntegerGood.txt.bz2

   This is a 56 MB download compressed with bzip2.

   I'd appreciate it if others could test this on other platforms.  I
don't anticipate any problems, though.

   I haven't had much time to finish the changes to the pow() function,
but there are some more optimizations I'd like to put in.

-- 
  Alan Eliasen              |  "Furious activity is no substitute
  [EMAIL PROTECTED]    |    for understanding."
  http://futureboy.us/      |           --H.H. Williams
import java.math.BigInteger;

public class BigIntegerRegressionTest
{
   public static void main(String args[])
   {
      BigInteger exp,b,c,r,r1,r2,bb2;

      for (int ee=0; ee<=1000; ee++)
      {
         for (int bb=-10; bb <= 10; bb++)
         {
             b = BigInteger.valueOf(bb);
             r = b.pow(ee);
             System.out.println("(" + bb + ")" + "^" + ee + "=" + r);
         }
      }


      for (int bb=-10; bb <= 10; bb++)
      {
         b = BigInteger.valueOf(bb);
         for (int ee=0; ee<=100; ee++)
         {
            r1 = b.pow(ee);
            for (int b2=-10; b2 <= 10; b2++)
            {
               bb2 = BigInteger.valueOf(b2);
               for (int e2=0; e2<100; e2++)
               {
                  r2 = bb2.pow(e2);
                  r = r1.multiply(r2);
                  System.out.println("(" + bb + ")" + "^" + ee + " * (" + b2 + 
")" + "^" + e2 + "=" + r);
               }
            }
         }
      }
   }
}

Reply via email to