[Python-ideas] checking for identity before comparing built-in objects

Mark Dickinson dickinsm at gmail.com
Fri Oct 12 19:26:18 CEST 2012

On Thu, Oct 11, 2012 at 2:20 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> E.g. log(x) should return -infinity if x underflows from a positive value,
> and a NaN if x underflows from a negative.

IEEE 754 disagrees. :-)  Both log(-0.0) and log(0.0) are required to
return -infinity (and/or signal the divideByZero exception).

And as for sqrt(-0.0) returning -0.0...  Grr.  I've never understood
the motivation for that one, especially as it disagrees with the usual
recommendations for complex square root (where the real part of the
result *always* has its sign bit cleared).


More information about the Python-ideas mailing list