[Python-Dev] math.hypot, complex.abs, and documentation (original) (raw)

Mark Dickinson dickinsm at gmail.com
Wed Feb 17 00:06:01 CET 2010


On Tue, Feb 16, 2010 at 10:46 PM, Steven D'Aprano <steve at pearwood.info>

What's the justification for that convention? It seems wrong to me.

It's difficult to do better than to point to Kahan's writings. See

http://www.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF

and particularly the discussion on page 8 that starts "Were there no way to get rid of NaNs ...". I don't think it covers hypot, but the same justification given for having nan**0 == 1 applies here.

Interestingly, he says that at the time of writing, 1nan == nan is the preferred alternative. But since then, the standards (well, at least C99 and IEEE 754-2008) have come out in favour of 1nan == 1.

Mark



More information about the Python-Dev mailing list