Welcome to GMP4D
The project aims to provide D with bindings to the GNU Multiple Precision Arithmetic Library. Especially the classes for integer, float and rational numbers make it possible to use arbitrary precision numbers like built-in data types! It is licensed under a BSD-style license, see LibraryLicense.
News
This project sleeps until DMD is able to overload the assignment of structs, because this is necessary, since GMP-internal data is reference-based and integers are value types, thus one must use structs. Copying a number to another must copy the referenced GMP-number, so the assignment-operator must be overloadable for same types. Currently, DMD uses bitwise-copy.
Until then you might find OOP bindings for GMP under the Bindings project. Those also add some stuff to work under Windows.
Features of the library
- The wrapper classes are implemented very simple and straightforward. One might think that they will be much slower than the C++ version, because those C++ guys make heavy use of templates there. This is just because classes in C++ are value types and overloaded operators will create a lot of temporaries. All those template stuff is for creating less temporaries. In D, the compiler will create a temporary, but it is not copied to the result - it's only referenced, which costs some assembly instructions, but nothing critical.
- As I/O won't be very complex, there will be support for Tango and Phobos.