-
huge-number-application
I´m a 15-year old interestet pupil and I´ve a big problem:
I wanna write c-applications which need huge numbers and
I think that there must exist some libraries which are easy to program. I use the gcc-compiler under Linux.
You can mail me at "[email protected]".
Thank you!
-
How big are the numbers you wants to use?
For example the maximum value a unsigned long integer can store is 4,294,967,295. You can specify it to be bigger ( for example as unsigned long long int ) and then you will a bigger range of values that is able to handle (I am not sure of the exact number, but it would go into trillions).
As far as liibraries are concerned, I am pretty sure there are some math libraries available, so I would recommend running a search on google to look for some.
Cheers.
-
GMP is what you want
-
well, there are two choices:
1. making an array of char's, and each char is a digit. and making your own functions for adding, substracting and everything else
Pros: very easy to understand and implement
easier to work with
easier to debug
Cons: a very interesting Memory waste
2. making an array of int's and summing the bits to have greater values (eg. an array of 1000 int's would make you a 32*1000=32000 bit variable)
Pros: Very fast, and cost-effective
Cons: VERY tough to implement
Oskilian