Is there a C++ equivalent to Java’s BigDecimal?

There exists a huge library called GMP (GNU multiple precision library) which supports this and also has C++ bindings, though to be honest the C++ interface is a bit wonky and outdated.

An example from the documentation, the following creates a float called f with at least 500 bits of precision:

mpf_class f(1.5, 500);

Leave a Comment