Is there an arbitrary precision floating point library for C/C++ which allows arbitrary precision exponents?

浪尽此生 提交于 2019-12-06 19:14:19

问题


I'm looking for an arbitrary precision floating point library for C/C++ (plain C is preferred). I need arbitrary precision exponents. GMP and MPFR use fixed size exponents, so they are ineligible (I have some ideas for workarounds, but I prefer an out-of-the-box solution). It would be an nice feature if the exponent precision can be adjusted automatically to prevent infinity-values.

If you know for sure that such an library does not exist, please say so.


回答1:


There is nothing as mainstream as GMP/MPFR as far as I know. But Fredrik Johansson's arb contains a module called fmpr that provides floating-point numbers with arbitrary precision exponents.




回答2:


That's a pretty specialized request; without knowing more about your actual needs, I might consider using a more common arbitrary-precision library like MPFR to represent the logarithms of your values (which doesn't quite give truly arbitrary exponent range, but does get you exponents so large that it's probably no longer an issue).




回答3:


You might take a look at http://www.ttmath.org/ - I don't think it can adjust precision on-the-fly, but it does support arbitrary precision reasonably well.



来源:https://stackoverflow.com/questions/12875930/is-there-an-arbitrary-precision-floating-point-library-for-c-c-which-allows-ar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!