I am trying to do some extreme precise maths calculation of very big/small number. The very big number may have 10 - 50 digits and the very small number may have 10 - 50 decimal places. Can C++ do this? If not is there any other programming language that can handle this kind of number?
C++ can do it with a library, for example the GNU Multiple Precision Arithmetic library.
Every language can handle such numbers if you implement the datatype for them correctly. I think you want a language that has such a datatype built-in.
Generally speaking, for the funcitioning of the double
datatype in C++, as well as in most other languages precision is very good for very small and very large numbers. I recommend to consult wikipedia on this, it is very well explained there.
The only question that remains is, if a double has enough precision for you. 50 digits would be too much for it to handle I guess, but you can still implement your own datatype. Since you now know how double works, this should be possible. However, you could still try searching for a math library that has such a datatype already implemented.
I think python (http://python.org) and ruby (http://ruby-lang.org) both have support for very big and very small numbers like that, you might give them a look. Also, both are interoperable with C++.
Hope this helps.
Hi
If you want to do very precise arithmetic, as opposed to writing C++ code to do very precise arithmetic, you should look at Mathematica, Maple, and their open-source competition such as Maxima, Sage, and probably others.
Regards
Mark
Many languages have support for arbitrarily large numbers, including (in alphabetical order) Haskell, Icon, Python, Scheme, and Smalltalk, among others. Support for very small numbers is rarer, unless what you want is exact rational arithmetic. If your computations on very small numbers must be exact, then I think exact rational arithmetic is your only alternative, but it gets expensive quickly. Your other option is to code your own floating-point arithmetic with many more digits of precision than are provided by a hardware floating-point unit. For this you need large-integer computation, which in C or C++ can be provided by the GNU GMP library or by Dave Hanson's C Interfaces and Implementations library.
If you are willing to try another language besides C++, I would recommend using Haskell, because it has very good facilities for creating new numeric types, and you can use QuickCheck to test your numeric types automatically, which is a tremendous time-saver and bug-finder.