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

Tim Peters tim.peters at gmail.com
Sun Mar 9 03:19:54 CET 2014


[Oscar Benjamin <oscar.j.benjamin at gmail.com>]
> ...
> I don't believe that a standards-compliant decimal module
> has any wiggle room to invent a new kind of rounding (which I think
> would be required to achieve what you suggest).

That would be true if the standard explicitly forbade extensions (any
optional operation or behavior not specified by the standard).  But
there are no standards like that ;-)  To comply with a standard, there
just needs to be _some_ way to "spell" all the behaviors the standard
mandates.  For example, in a programming language no relevant 754-ish
standard says that the infix binary operator "*" has to implement
754-ish multiplication.  So far as standard compliance goes, "*" could
mean "ignore the second argument and add 1.7 to the first argument,
rounding toward 7" - just so long as there's *some* way to spell
"754-ish multiplication".

Python (or any other implementation) is quite free to invent all the
rounding modes (or any other kinds of operations, or modifications to
standard behaviors) it likes.  That kind of experimentation is where
ideas for the _next_ iteration of the standard comes from.


More information about the Python-ideas mailing list