开发者

What library for arbitrary precision library should I use?

开发者 https://www.devze.com 2023-02-12 17:09 出处:网络
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

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...开发者_运维技巧


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.


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

精彩评论

暂无评论...
验证码 换一张
取 消