[Python-ideas] Python Numbers as Human Concept Decimal System

Stefan Krah stefan at bytereef.org
Mon Mar 10 14:53:42 CET 2014


[My apologies for being terse, I don't have much time to follow this
discussion right now.]


Nick Coghlan <ncoghlan at gmail.com> wrote:
> I think users of decimal literals will just need to deal with the risk of
> unexpected rounding, as the alternatives are even more problematic.

That is why I think we should seriously consider moving to IEEE semantics
for a decimal literal.  Among other things:

  - Always round the literal inputs.

  - Supply IEEE contexts.

  - Make Decimal64 the default.

  - Add the missing rounding modes to sqrt() and exp().

  - Keep the ability to create exact Decimals through the constructor when
    no context is passed.

  - Make the Decimal constructor use the context for rounding if it is passed.

  - ...

 
The existing specification is largely compatible with IEEE 754-2008:

  http://speleotrove.com/decimal/dascope.html


We can still support setting irregular (non IEEE) contexts.



Stefan Krah




More information about the Python-ideas mailing list