3.2*2 is 9.6 ... or maybe it isn't?

Mensanator mensanator at aol.com
Fri Jun 26 01:53:39 CEST 2009


On Jun 25, 6:43 pm, Scott David Daniels <Scott.Dani... at Acm.Org> wrote:
> Robert Kern wrote:
> > ... I wish people would stop representing decimal floating point arithmetic
> > as "more accurate" than binary floating point arithmetic. It isn't.
> > Decimal floating point arithmetic does have an extremely useful niche:
> > ...
>
> Well, we don't actually have an arbitrary-precision, huge exponent
> version of binary floating point.  In that sense the Decimal floating
> point beats it.  Not that it would be too hard to have such a floating
> point in Python (long for mantissa, int for exponent, ...), but we don't
> in fact have such a module in place.

We have the gmpy module which can do arbitray precision floats.

>>> gmpy.pi(600)
mpf
('3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446e0',
600)

>
> --Scott David Daniels
> Scott.Dani... at Acm.Org




More information about the Python-list mailing list