Post by troycheek on Aug 21, 2015 1:51:45 GMT 1
So, I was playing around with creating/verifying prime numbers with GB32. I discovered that the largest integer number you can store in an Int64 aka Large variable is 2^63-1 or about 9 quintillion which is defined by the constant _maxLarge. (It's possible GB32 uses temporary larger values internally when performing calculations, but that's the largest it can store in a variable.) While 9x10^18 seems like a huge number to me, in prime number circles this is apparently a "very small number." In contrast, the largest known prime number is 2^57 million or so, a number which is 17 million digits long. Just calculating and displaying that number in GB32 would be non-trivial.
Digging around on the web, it seems that many languages have what is called a "BigInt Class" which is a set of routines for doing math on arbitrarily large integers. I've not delved deeply into this, but my guess is that the BigInt method either "stacks" multiple Int64 variables (creating what is effectively Int128 or higher) or puts the individual digits in a numeric/string array and operates on each digit independently like grade school long division. Since I can create a string 256 million bytes long, I could probably create some routines to add/subtract/multiply/divide them as numbers. That should be big enough to play with what prime number enthusiasts would call a "large prime."
However, before I start digging into this, I thought I would check here to see if there are any GB32 keywords for dealing with larger integers that I'm overlooking, and to see if anyone has already implemented some BigInt routines in GFA. Maybe there's a BigInt C DLL I could import and use?
Edit: If I've done this right, the largest prime you can "easily" calculate with GB32 is 9223372036854775783 or 2^63-25. I started with _maxLarge (2^63-1) and worked my way down.
Digging around on the web, it seems that many languages have what is called a "BigInt Class" which is a set of routines for doing math on arbitrarily large integers. I've not delved deeply into this, but my guess is that the BigInt method either "stacks" multiple Int64 variables (creating what is effectively Int128 or higher) or puts the individual digits in a numeric/string array and operates on each digit independently like grade school long division. Since I can create a string 256 million bytes long, I could probably create some routines to add/subtract/multiply/divide them as numbers. That should be big enough to play with what prime number enthusiasts would call a "large prime."
However, before I start digging into this, I thought I would check here to see if there are any GB32 keywords for dealing with larger integers that I'm overlooking, and to see if anyone has already implemented some BigInt routines in GFA. Maybe there's a BigInt C DLL I could import and use?
Edit: If I've done this right, the largest prime you can "easily" calculate with GB32 is 9223372036854775783 or 2^63-25. I started with _maxLarge (2^63-1) and worked my way down.