user1743775
user1743775

Reputation: 121

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

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.

Upvotes: 12

Views: 3378

Answers (3)

Stephen Canon
Stephen Canon

Reputation: 106117

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).

Upvotes: 1

Mathew Eis
Mathew Eis

Reputation: 290

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.

Upvotes: 0

Marc Mezzarobba
Marc Mezzarobba

Reputation: 61

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.

Upvotes: 6

Related Questions