You are here:



Some computer programs like Mathematica can calculate to a very high degree of precision, for example computing Pi with
10000 digits after the floating point. How is it possible?
As far as I know the largest amount of memory that could be
given to a specific type of data is "long double" with 10 bytes.
Thank you

Extended precision is done with add-on libraries or classes.  A common method is a class that supports BCD math.  The class can define the number of byte, which yields twice the number of digits supported.  I suppose an extended floating point class is possible but doing floating point in C++ is difficult.  I'm surprised about PI to 10000 digits but will not question you since I don't know Mathematica.  Whether that package can do arbitrary mathematics and trig to 10000 digits would really be astounding and I have to say I do doubt this.

Check Google for C++ BCD class.  Which by the way you'll find an answer of mine to a similar question.



All Answers

Answers by Expert:

Ask Experts


Bill A


I can answer questions about C++, programming algorithms, Windows programming in MFC (which is C++). I cannot answer questions about STL (templates) and I have no experience with Linux. I do enjoy reviewing code and critiquing it or finding problems in it. I will also gladly show better algorithms or methods if you want to take advantage of that.


I've developed a commercial embedded C compiler/assembler and IDE with debugger toolset, of which the IDE and debugger are written in C++. I work in the industry writing high tech embedded programs and Windows programs to communicate with the embedded devices.

Book: Embedded Systems Design using the Rabbit 3000 Microprocessor Authored Chapter 10 in its entirety.

BS Computer Engineering

©2016 All rights reserved.