[kaffe] Bug Report: Large BigIntegers aren't displayed

Alan Eliasen eliasen at mindspring.com
Mon Apr 19 03:22:19 PDT 2004


   I've been happily experimenting with using Kaffe to run my programming
language/calculating tool "Frink" : http://futureboy.homeip.net/frinkdocs/ in
order to get the high-performance integer performance of the GP library, but
I'm having some problems.

   I've compiled Kaffe with the GMP libraries on Linux (Red Hat 9).
Engine: Just-in-time v3   Version: 1.1.4   Java Version: 1.1
Note:  I compiled GMP with --disable-fft due to known bugs in the FFT
multiplication routines.

   When I try to calculate and display large integers (say, large Mersenne
primes, it works up to a point, and then large numbers, say, 2^13466917-1
simply don't get formatted at all by the toString() method.  Running the "top"
command shows that nothing's running, no exceptions are thrown, and the
program doesn't continue.

   Below is a sample program that illustrates the problem.  If you replace the
number 13466917 with a smaller number, it is displayed correctly.  This sample
works as expected (although bloody slow (15+ hours ?!) for the toString()
method in Sun's VMs.)

------------------------------------------------------
import java.math.BigInteger;

public class BigIntTest
{
   /** This calculates the (previously) largest-known Mersenne Prime,
       2^13466917 - 1 */
   public static void main(String[] args)
   {
      System.out.println("Starting");
      BigInteger b = new BigInteger("2");

      BigInteger p = b.shiftLeft(13466917 - 1);
      System.out.println("Exponentiation complete");
      p = p.subtract(new BigInteger("1"));
      System.out.println("Subtraction complete");

      System.out.println(p.toString());
      System.out.println("Formatting completed.");
   }
}
-------------------------------------------------------------

   If anyone has any hints, workarounds, or can simply verify this behavior,
please let me know.

-- 
  Alan Eliasen                 | "You cannot reason a person out of a
  eliasen at mindspring.com       |  position he did not reason himself
  http://futureboy.homeip.net/ |  into in the first place."
                               |     --Jonathan Swift





More information about the kaffe mailing list