python decimals

Andrew Svetlov andrew.svetlov at
Wed Sep 16 22:25:50 CEST 2009

Decimal has good enough API and we need to follow it as lot of our
code already operates with Decimal.
Maybe with different Context and exception types and limited subset of
operations - but switching should be not very hard.
Decimal arithmetic is good for as. We need to support several types
like Currency and standard floating point arithmetic make well known
failures in fraction point for some cases.
Really standard decimal module is exact what we need except

I'm skeptical about ctypes for this specific case but like to use

Of course library will be open source. Perhaps I will start to work on
it about end of next week - it's high priority task for my company.

On Sep 16, 4:49 am, Mark Dickinson <dicki... at> wrote:
> On Sep 16, 1:35 am, Andrew Svetlov <andrew.svet... at> wrote:
> > It only reflects the fact what comp.lang.python replicated by several
> > web sites.
> > Unfortunately looks like there are no link to library implements that :
> > (
> A few random thoughts:
> If you just want fixed-precision decimal, there may be simpler
> solutions
> than using the decimal module.  Contrary to popular belief, the
> decimal
> module (and decNumber) provides floating-point decimal arithmetic, not
> fixed-point (though its treatment of exponents means that it can
> emulate
> fixed-point arithmetic well).
> Can you use the ctypes module to wrap the decnumber library?  That
> might be faster than writing a full-fledged extension module.  Cython
> might be useful, too.
> If you do create your own Python bindings for decnumber, is there any
> chance you'd be allowed make them public (e.g., on PyPI)?  I think
> there are many people who would find such bindings useful.
> --
> Mark

More information about the Python-list mailing list