[Python-ideas] Floating point contexts in Python core
Alexander Belopolsky
alexander.belopolsky at gmail.com
Thu Oct 11 00:56:08 CEST 2012
On Oct 10, 2012, at 6:42 PM, Oscar Benjamin <oscar.j.benjamin at gmail.com> wrote:
>> If we want to do *anything* I think we should first introduce a
>> floating point context similar to the Decimal context. Then we can
>> talk.
>
> The other thread has gone on for ages now and isn't going anywhere.
> Guido's suggestion here is much more interesting (to me) so I want to
> start a new thread on this subject. Python's default handling of
> floating point operations is IEEE-754 compliant which in my opinion is
> the obvious and right thing to do.
I gave this idea +float('inf') in the other thread and was thinking about it since. I am now toying with the idea to unify float and decimal in Python. IEEE combined their two FP standards in one recently, so we have a precedent for this.
We can start by extending decimal to support radix 2 and once that code is mature enough and has accelerated code for platform formats (single, double, long double), we can replace Python float with the new fully platform independent IEEE 754 compliant implementation. We can even supply a legacy context to support some current warts.
More information about the Python-ideas
mailing list