Re: [Python-Dev] math.hypot, complex.__abs__, and documentation

2010-02-17 Thread Mark Dickinson
[With apologies for Steven for the duplicate email.] On Wed, Feb 17, 2010 at 12:22 PM, Steven D'Aprano wrote: > Well, who am I to question Kahan? Yes, there I go with the argument from authority. But while we shouldn't instantly accept Kahan's arguments just because he's Kahan, it would be equa

Re: [Python-Dev] math.hypot, complex.__abs__, and documentation

2010-02-17 Thread Steven D'Aprano
On Wed, 17 Feb 2010 10:06:01 am Mark Dickinson wrote: > On Tue, Feb 16, 2010 at 10:46 PM, Steven D'Aprano > > > > 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/iee

Re: [Python-Dev] math.hypot, complex.__abs__, and documentation

2010-02-16 Thread Mark Dickinson
On Tue, Feb 16, 2010 at 11:06 PM, Mark Dickinson wrote: > 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 Whoops. I should have reread that article myself. The behaviour of hypot *is* mentioned, on page

Re: [Python-Dev] math.hypot, complex.__abs__, and documentation

2010-02-16 Thread Mark Dickinson
On Tue, Feb 16, 2010 at 10:46 PM, Steven D'Aprano > 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 t

Re: [Python-Dev] math.hypot, complex.__abs__, and documentation

2010-02-16 Thread David DiCato
ces+ddicato=microsoft@python.org] On Behalf Of Steven D'Aprano Sent: Tuesday, February 16, 2010 2:47 PM To: python-dev@python.org Subject: Re: [Python-Dev] math.hypot, complex.__abs__, and documentation On Wed, 17 Feb 2010 08:19:00 am David DiCato wrote: > I have a minor concern about ce

Re: [Python-Dev] math.hypot, complex.__abs__, and documentation

2010-02-16 Thread Steven D'Aprano
On Wed, 17 Feb 2010 08:19:00 am David DiCato wrote: > I have a minor concern about certain corner cases with math.hypot and > complex.__abs__, namely when one component is infinite and one is not > a number. If we execute the following code: > > import math > inf = float('inf') > nan = float('nan')

Re: [Python-Dev] math.hypot, complex.__abs__, and documentation

2010-02-16 Thread David DiCato
Ok, thanks! It's submitted as issue 7947. - David -Original Message- From: Mark Dickinson [mailto:dicki...@gmail.com] Sent: Tuesday, February 16, 2010 2:15 PM To: David DiCato Cc: python-dev@python.org Subject: Re: [Python-Dev] math.hypot, complex.__abs__, and documentation On Tue

Re: [Python-Dev] math.hypot, complex.__abs__, and documentation

2010-02-16 Thread Mark Dickinson
On Tue, Feb 16, 2010 at 9:19 PM, David DiCato wrote: > I have a minor concern about certain corner cases with math.hypot and > complex.__abs__, namely when one component is infinite and one is not a > number. > as well, and FWIW, I personally agree with this convention. However, the > math modu

Re: [Python-Dev] math.hypot, complex.__abs__, and documentation

2010-02-16 Thread Nick Coghlan
David DiCato wrote: > … then we see that ‘inf’ is printed in both cases. The standard library > tests (for example, test_cmath.py:test_abs()) seem to test for this > behavior as well, and FWIW, I personally agree with this convention. > However, the math module’s documentation for both 2.6 and 3.1

[Python-Dev] math.hypot, complex.__abs__, and documentation

2010-02-16 Thread David DiCato
I have a minor concern about certain corner cases with math.hypot and complex.__abs__, namely when one component is infinite and one is not a number. If we execute the following code: import math inf = float('inf') nan = float('nan') print math.hypot(inf, nan) print abs(complex(nan, inf)) ... t