Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Large numbers...

Large numbers...
Thread Tools
Fresh-Faced Recruit
Join Date: May 2001
Status: Offline
Reply With Quote
May 22, 2001, 02:22 AM
 
Hi!
I need to work with very large numbers, say over 100 digits. C's "unsigned long long" only support 64 bits (2^64). The numbers I need to work with is about 2^257. All digits matter, because I'm trying to prove that the numbers are primes (Mersenne primes). I'm thinking of storing the numbers as strings (as there is no limit on array's - I will need a lot of memory but that is not a problem but I can't figure out how to do the needed math. Help?
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
May 22, 2001, 08:29 PM
 
If you want a pre-made library for this (it's called "Arbitrary precision"), try GMP or PARI. PARI will do stuff with complex numbers as well (I think).

If you're looking to do it yourself (it's fun), check out ext/bcmath for ideas in the PHP source code. (I think that's the path)

"Against stupidity, the gods themselves contend in vain" (Schiller)
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:03 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2