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

Well, who am I to question Kahan?

I guess if you interpret nan as "indeterminate", than hypot(inf, nan) 
should be inf; but if you interpret it as "not a number", then it 
should be nan. Since NANs can be both, I guess we're stuck with one or 
the other. So I'm satisfied that there's a good reason for the 
behaviour, even if I'm not 100% convinced it's the best reason.

On a related note, why the distinction here?

>>> inf*inf
inf
>>> inf**2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: (34, 'Numerical result out of range')



-- 
Steven D'Aprano
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to