Rafael
Rafael

Reputation: 452

How to define a floating-point data type larger than 16 bytes?

I'm trying to do math calculations that they require more than 100 decimals of precision. C data types cannot go beyond 16 bytes (long double), so I cannot compute more than ~17 decimals. Is there a way to create a variable in C that can get more precision?

Upvotes: 0

Views: 114

Answers (1)

Simon Byrne
Simon Byrne

Reputation: 7864

Realistically you need an arbitrary-precision arithmetic library, see Wikipedia for some options. I personally have found GNU MPFR to be fairly reliable, though I have also heard good things about Arb.

Upvotes: 3

Related Questions