Thursday, March 18, 2004

mxNumber - Extended Numeric Types for Python: "Moshe Zadka, one of the Python Core Developers, has been pushing for a new rational number type recently (at the IPC9 conference) and also implemented a proof-of-concept implementation of his rational PEP 239.


Since the GNU Multi-Precision Library (GMP) already has all these number types and also provides what people want most when it comes to numbers: precision and speed, I thought that wrapping these as Python types would be a good idea. I know that Alex Martelli has been working on a similar approach, but that project (http://gmpy.sourceforge.net/) seems to be inactive and I wanted to find out whether the new coercion patches in 2.1 actually make life easier for the extensions writer.


Anyway, even though the GMP is available for most Unix platforms and MacOS, there was no relyable port for Windows. This was a show-stopper for me, so I decided to port GMP to Windows, which was harder than I thought, but well, it's done now. You can get the GMP Windows port from here.
The mxNumber package defines the following number types and implements most interoperability features needed to use these as if they were native Python number types: "