Click here to Skip to main content
15,922,015 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i deal with large numbers in C++. Example 26000 or numbers raised to the powers of any two large prime numbers.

I am unable to process or store large numbers in C++. Is there any way to achieve that?
Updated 9-Jun-13 0:12am

You need a library for big integers. Google[^] is your friend.

Have a look at the following Wikipedia pages:

There you may also find links to known implementations.
Share this answer
Sergey Alexandrovich Kryukov 9-Jun-13 13:24pm    
Fair enough, a 5.
CPallini 9-Jun-13 14:03pm    
Thank you.
compuknow 10-Jun-13 4:57am    
Are there any simple ones , I found a simple library called 'InfInt' (with only one header file) but it cannot hold floating numbers. Are there any similar simple libraries ?
CPallini 10-Jun-13 5:47am    
Well a big integer library is not expected to deal with floating point numbers, is it?
compuknow 10-Jun-13 6:36am    
Is there any library you know which can store large floating numbers ? How can store values that are too small in C++ ? Does double support large values?
perhaps System.Numerics.BigInteger is what you are looking for:[^]
Share this answer
Ron Beyer 9-Jun-13 9:44am    
System.Numerics.BigInteger is only for .NET, he doesn't say that he's using .NET, just C++ so this probably won't work for him.
compuknow 10-Jun-13 6:41am    
How to use it in visual C++ ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900