[Python-Dev] Tuples vs. lists
M.-A. Lemburg
mal@lemburg.com
Wed, 06 Feb 2002 09:45:51 +0100
Aahz Maruch wrote:
>
> >> Arrays might
> >> work, but I think I'll stick with tuples because they're a bit more
> >> familiar to most Pythonistas. I'm not too concerned with raw speed and
> >> efficiency before I convert the code to C; remember Knuth.
> >
> > If you plan to convert this to C, why not have a look at mxNumber
> > first ? It's a wrapper around GMP and provides high performance
> > implementations for many numeric operations, e.g. it should be easy
> > to create a BCD type using the GMP (arbitrary length) longs and an
> > additional C long for the decimal point position. In fact, there's a
> > GMP extension MPFR which tries to do just this.
>
> I'm specifically implementing the ANSI BCD spec. If you want to argue
> the theory of this, poke the Timbot; I think it's simpler to ensure that
> I'm following the spec if I implement everything by hand. Once I really
> understand what I'm doing, *then* it's time to optimize.
Just thought you might want to take a look at what other people
have done in this area. MPFR is specifically aimed at dealing
with the problems of rounding; MPFI which implements interval
arithmetics based on MPFR takes a slightly different approach:
rounding issues are handled using intervals (these are also very
handy in optimization).
Pointers:
http://www.loria.fr/projets/mpfr/
http://www.ens-lyon.fr/~nrevol/nr_software.html
> Note that one reason for using BCD over GMP longs (which are presumably
> similar to Python longs) is speed of I/O conversion.
Depends on which base you use for that conversion ;-)
--
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting: http://www.egenix.com/
Python Software: http://www.egenix.com/files/python/