Large Numbers

Hello Everyone. I have a problem here, I'd really appreciate if someone could help me. I need to find sum of 2 numbers. But as it appears this isn't easy. These numbers have 10000 digits and I don't know any type that can hold them in C++. Please HELP!!!!
You didn't specifiy the type of that numbers. Are they float or integer? If they are integer, I don't know any type that can help you but if they are float, you can use long double type. This type can hold numbers with 85000 digits (but the number is float).
Last edited on
There are integers. Isn't there any other way?
Thanks for quick response
you can use long double type. This type can hold numbers with 85000 digits


No they can't. They have a wide range, but they have limited precision.

Isn't there any other way?


There isn't any built-in language type that does what you want, but there are libraries. They're called "bignum" libraries.

Here is a popular one:

http://gmplib.org/



Alternatively, you could store the numbers as strings and "manually" do the addition yourself.
Last edited on
Thanks for the idea. It worked ))))
Topic archived. No new replies allowed.