Tim Peters <t...@python.org> added the comment:

Some notes on the hypot() code I pasted in:  first, it has to special case 
infinities too - it works fine if there's only one of 'em, but returns a NaN if 
there's more than one (it ends up computing inf/inf, and the resulting NaN 
propagates).

Second, it's not clear to me what the result "should be" if there's at least 
one infinity _and_ at least one NaN.  At the start, "anything with a NaN input 
returns a NaN" was the rule everything followed.  Later an exception to that 
was made for NaN**0 == 1, under the theory that it didn't really matter if the 
computation of the base screwed up, because anything whatsoever to the 0 power 
is 1 0 viewing NaN as meaning "we have no idea what the true value is", it 
simply doesn't matter what the true value is in this context.  By the same 
logic, if there's an infinite argument to hypot(), it doesn't matter what any 
other argument is - the result is +inf regardless.  So that requires some 
investigation.  Offhand I'm inclined to return NaN anyway.

Finally, if there is a robust single-rounding dot product, of course scaling 
can be skipped (and so eliminate another source of small errors).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33089>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to