Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

C++ long long.... long numbers

hi.
is it possible in c++ to do operations with very long numbers like 10^10000 without using arbitrary precision arithmetic? maby with some memory access?
python allows to do operations very very long numbers like like 10^10000 , using operators +,-,*,/ but in c++ the max number type is base64 and i must be not usuall operators
No. C or C++ do not have built-in support arbitrary precision arithmetic. You would need to create your own data types and functions to achieve it or use an external library like GMP.
(Nov 25, 2010 10:53 AM)alt2600 Wrote:  hi.
is it possible in c++ to do operations with very long numbers like 10^10000 without using arbitrary precision arithmetic? maby with some memory access?
python allows to do operations very very long numbers like like 10^10000 , using operators +,-,*,/ but in c++ the max number type is base64 and i must be not usuall operators

No you have to use 'arbitrary precision arithmetic'...The machine or CPU only understands a limited number of number formats,

unsigned/signed char, short, int and long plus your floats.

For anything else you'll need code to work out the details...Even Python uses 'arbitrary precision arithmetic' but its transparent to the user.
(Nov 25, 2010 11:05 AM)g4143 Wrote:  No you have to use 'arbitrary precision arithmetic'...The machine or CPU only understands a limited number of number formats,
the problem i that length of numbers is limited and i need to use very very big numbers, for excample 555!
in python its simple, i use math.factorial(555), but in c++ i cant work with numbers like this
On my compiler long long int go to 10,000,000.
10,000,000 it is not so big number as i need
Could you possibly use some sort of system to convert the numbers into standard index form? I don't know whether that'd be easier or harder though..
(Nov 25, 2010 11:33 AM)Scorch Wrote:  On my compiler long long int go to 10,000,000.

So your system uses 23.253 bit integers?
I'm interested in this subject as well but I'm yet to find an easy, flexible solution that I'd be satisfied with. I write in pure C, though.
(Nov 25, 2010 12:29 PM)sbrg Wrote:  So your system uses 23.253 bit integers?

Yes it incorporates the new chip, the one that has varying degrees of units.


(Nov 25, 2010 12:52 PM)Etheryte Wrote:  I'm interested in this subject as well but I'm yet to find an easy, flexible solution that I'd be satisfied with. I write in pure C, though.

What could be easier than including a library that some one else wrote and using its functionality?
(Nov 25, 2010 12:58 PM)g4143 Wrote:  What could be easier than including a library that some one else wrote and using its functionality?

I'm sorry, I missed out on the library whilst glancing at the thread, I'm looking into it right now.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Java] by cryptobassboostFeb 7, 2019 05:28 PM 4 219 Feb 7, 2019 05:28 PM
Last Post: Caliban
[Python] by EchoeMay 14, 2013 07:50 AM 12 293 May 14, 2013 07:50 AM
Last Post: skadoosh369
[C#] by svavartFeb 4, 2012 10:04 AM 9 318 Feb 4, 2012 10:04 AM
Last Post: Gh0st-Zer0