August 20, 2021

I am working in a D wrapper for libmpdec. It is part of mpdecimal is a package for correctly-rounded arbitrary precision decimal floating point arithmetic writter by Stefan Krah.

Decimal types are important in applications that require exact computations like accounting or finance.

You can find an initial version at

https://github.com/pdenapo/d-mpdecimal

My project offers bindings and a wrapper for using limpdec from D language.

  • mpdec.mpdec is a translation of the original header from C to D. (This allows you to call the libmpec functions from D).

  • mpdec.decimal is a high-level wrapper over libmpec using the features of the D language (like structs and operator overloading).

This work is distributed under the MIT license (see the LICENSE file).

Some sample test programs are also provided.

¡Any help is much appreciated! (like comment, testing, etc.).

I am planning to add this project later to the dub registry.
There are some other pure-D solutions there (like "fixed" or "decimal") but seem to be
somewhat buggy or unmaintained.

I believe that limpdec is a high-quality library (used for instance by the Python decimal module), and so I think that this might be a useful contribution to the D community.