Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Fast decimal arithmetic module released

Reply
Thread Tools

Fast decimal arithmetic module released

 
 
Mark Dickinson
Guest
Posts: n/a
 
      10-02-2009
On Oct 2, 8:53*pm, Stefan Krah <(E-Mail Removed)> wrote:
> Hi,
>
> today I have released the following packages for fast arbitrary precision
> decimal arithmetic:
>

[...]

Nice! I'd been wondering how you'd been finding all those decimal.py
bugs. Now I know.

--
Mark
 
Reply With Quote
 
 
 
 
Stefan Krah
Guest
Posts: n/a
 
      10-02-2009

Hi,

today I have released the following packages for fast arbitrary precision
decimal arithmetic:


1. libmpdec
============

Libmpdec is a C (C++ ready) library for arbitrary precision decimal
arithmetic. It is a complete implementation of Mike Cowlishaw's
General Decimal Arithmetic specification.


2. fastdec.so
==============

Fastdec.so is a Python C module with the same functionality as decimal.py.
With some restrictions, code written for for decimal.py should work
identically.


3. deccheck.py
===============

deccheck.py performs redundant calculations using both decimal.py and
fastdec.so. For each calculation the results of both modules are compared
and an exception is raised if they differ. This module was mainly developed
for testing, but could in principle be used for redundant calculations.



Correctness
============

Libmpdec passes IBM's official test suite and a multitude of additional tests.
Fastdec.so passes (with minor modifications) all Python unit tests. When run
directly, deccheck.py performs very exhaustive tests that compare fastdec.so
with decimal.py.

All tests complete successfully under Valgrind.


Speed
======

In a couple of initial benchmarks, libmpdec compares very well against
decNumber and the Intel decimal library. For very large numbers, the speed
is roughly the same as the speed of the apfloat library.

Fastdec.so compares quite well against gmpy and even native Python floats.
In the benchmarks, it is significantly faster than Java's BigDecimal class.


Portability
============

All tests have been completed on Linux 64/32-bit, Windows 64/32-bit, OpenSolaris
32-bit, OpenBSD 32-bit and Debian Mips 32-bit. For 32-bit platforms there is
a pure ANSI C version, 64 bit platforms require a couple of asm lines.



Further information and downloads at:

http://www.bytereef.org/libmpdec.html



Stefan Krah



 
Reply With Quote
 
 
 
 
Raymond Hettinger
Guest
Posts: n/a
 
      10-02-2009
[Stefan Krah]
> today I have released the following packages for fast arbitrary precision
> decimal arithmetic:


Nice.


Raymond
 
Reply With Quote
 
Stefan Krah
Guest
Posts: n/a
 
      10-03-2009
Mark Dickinson <(E-Mail Removed)> wrote:
> On Oct 2, 8:53*pm, Stefan Krah <(E-Mail Removed)> wrote:
> > Hi,
> >
> > today I have released the following packages for fast arbitrary precision
> > decimal arithmetic:
> >

> [...]
>
> Nice! I'd been wondering how you'd been finding all those decimal.py
> bugs. Now I know.


Thanks! Yes, actually deccheck.py deserves the credit.


Stefan Krah


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ Topic - Why does simple decimal arithmetic give strange results? FAQ server Javascript 2 08-17-2007 07:16 AM
Decimal to Packed Decimal Conversion in C++ Ven C++ 3 08-01-2006 03:56 PM
ANN: DecInt 0.3 - Arithmetic for very large decimal integers casevh@comcast.net Python 0 11-30-2005 07:51 AM
Re: ANN: BigDecimal - decimal arithmetic on very large intergers M.-A. Lemburg Python 3 04-04-2005 01:59 PM
Usual Arithmetic Conversions-arithmetic expressions joshc C Programming 5 03-31-2005 02:23 AM



Advertisments