[Python-ideas] Disallow orderring comparison to NaN
Robert Kern
robert.kern at gmail.com
Fri Apr 29 00:13:33 CEST 2011
On 4/28/11 12:00 PM, Alexander Belopolsky wrote:
> On Thu, Apr 28, 2011 at 12:46 PM, Robert Kern<robert.kern at gmail.com> wrote:
> ..
>> Python uses the< operator for sorting, not a comparison function, so it's
>> current behavior is perfectly in line with the IEEE-754 spec.
>
> No, it is not. As I explained in the previous post, IEEE-754
> prescribes different behavior for<,>,<=, and>= operations and !=
> and ==. The former signal INVALID exception while the later don't.
> Python does not make this distinction.
But it also states that such signals should *not* trap by default. The only
thing I can really fault Python for, compliance-wise, is that it will hide the
FPE from being handled in user code because of the
PyFPE_START_PROTECT/PyFPE_END_PROTECT macros that surround the actual C
operation. The only way to get the FPE to handle it is to build and install
fpectl, which is officially discouraged.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-ideas
mailing list