I have a very large number, assume some transaction id or big money involved. So, how I will handle the calculation on these ( add, multiple etc). Does any other was to sto
If your numbers are larger than int, long or double. Use type long long and do not worry about adding, multiplication etc.
You use a library that handles big numbers, like The GNU Multiple Precision Arithmetic Library which seems to be the most common. Or if you want Boost specifically, there's always the Multiprecision library (which can use GMP as backend).
The closest to a standard is The GNU Multiple Precision Arithmetic Library.
Please check boost multiprecision library .. It will be handy if your project is already using boost. boost multiprecision library
you can Wrote a large number of classes handle the calculation. use the Array of characters store your data.
For This Question We Should Create a
Divided And Conquer Recursive Function And I Show You
How You can Do That :
Problem = Multiple U*V Tow 100 Digit numbers ..
Function Output = (Prod) Return U*V
Long Long Long Integer Numbers ...
Like 9999999999999999*99999999999999999
Create Class Like That in your Programming Language ..
In This Project t(n) = 4t(n/2) + CN !!
Sample For Tow Little Number In Mathematica :
4795 * 2412 = ?
n =4 (Digits of 4795)
Result :
(47 * 10^2 +95) * (24 * 10^2 + 12) =>
=> (47 * 24 * 10^4) + (47 * 12 * 10^2)+ (95 * 24 * 10^2) + 95 *12
=> 47 *24 * 10^4 + 47*12 + 95 * 24 + 10^2 + 95 * 12 = Result Of Function
Best Regards Aj.Duende (Persian Guy)