What library for arbitrary precision library should I use?

233 views Asked by At

I need to program something that calculates a number to arbitrary precision...

but I need it to output the digits that are already "certain" (ie below some error bound) to a file so that there are digits to work on while the program keeps running.

Also, most libraries for arbitrary precision seem to require a fixed precision, but what if I wanted dynamic precision, ie, it would go on and on...

2

There are 2 answers

3
paxdiablo On

My advice is to use MPIR. It's a fork of GMP but with (in my opinion) a more helpful and developer-friendly crew.

0
casevh On

Most algorithms that calculate a number to extended precision require that all intermediate calculations are done to a somewhat higher precision to guarantee accurate results. You normally specify your final desired precision and that's the result that you get. If you want to output the "known" accurate digits during the calculation, you'll generally need to implement the algorithm and track the accurate digits yourself.

Without knowing what number you want to calculate, I can't offer any better suggestions.

GMP/MPIR only support very basic floating point calculations. MPFR, which requires either GMP or MPIR, provides a much broader set of floating point operations.