Huge #'s
-
- Enthusiast
- Posts: 340
- Joined: Tue Apr 24, 2007 11:14 pm
Huge #'s
Could someone give me a way to account for huge huge numbers w/out having to use a plugin-library
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
There are bignum dlls around the web if you do a google search. It shouldn't be too hard to find one that'll work well with PB. They are usually string-based and have all their own math functions for the various operations, usually including factorials. All the functions will probably take in and return a string, and there's usually not a practical limit on the number of digits they'll work with. After all, that's the whole point. You could write something in PureBasic, but this is a wheel that's been invented and optimized many times over already, so it's just a matter of finding a freely shared one. There's several, I know.
BERESHEIT
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
A well known big numbers lib is GMP : http://gmplib.org/
And here are some threads about how to use it with PB :
http://purebasic.fr/english/viewtopic.php?t=22635
http://www.purebasic.fr/french/viewtopic.php?t=6849
And here are some threads about how to use it with PB :
http://purebasic.fr/english/viewtopic.php?t=22635
http://www.purebasic.fr/french/viewtopic.php?t=6849
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- Enthusiast
- Posts: 340
- Joined: Tue Apr 24, 2007 11:14 pm
It is for Project Euler at http://www.projecteuler.net
-
- Enthusiast
- Posts: 340
- Joined: Tue Apr 24, 2007 11:14 pm
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Hi Michael,michaeled314 wrote:It is for Project Euler at http://www.projecteuler.net
the problems of project euler (at least the first 100 of them;) can be solved without any external library just with pure purebasic

If you've to handle longer numbers, you need usually only the functions add and multiply, you can find procedures for doing that job at... >>surprise<< http://www.purebasic.fr/english/viewtop ... 85&start=0 within my first code posting...
If you're able to optimize my routines (for speed) or even add some more functions (like div, sub) you'll be a hero (or something like that

Michael