[Python-Dev] Decimal floats as default (was: discussion aboutPEP239 and 240)

Michael Chermside mcherm at mcherm.com
Mon Jun 27 17:33:43 CEST 2005


Fredrik Johansson writes:
> In either case, compatibility can be ensured by allowing both n-digit
> decimal and hardware binary precision for floats, settable via a float
> context.

Perhaps you can show me a design (or working code) that proves me
wrong, but I don't believe that such a design could be made compatible
with the existing Decimal module... certainly while continuing to
maintain compatibility with the Cowlinshaw specification.

> There is the alternative of providing decimal literals by using
> separate decimal and binary float base types

If, by this, you mean adding a "binary float context" modeled after
the Decimal float context and providing access to the underlying FP
flags and traps and generally enhancing the use of binary FP, then
I think it's a great idea. It's probably impossible to write in a
cross-platform manner (because C supplies support for binary FP but
does not offer access to the flags and traps), but this is one of those
few cases where it's worth using platform-and-compiler specific code.

Of course, someone still has to step forward and offer to code it.

-- Michael Chermside



More information about the Python-Dev mailing list