Mark Dickinson added the comment:

> Shouldn't floating-point operations overflow to inf, not generate exceptions?

This has been discussed a few times before (I'll try to find the references).

But to answer you question: actually, no.  I think they *should* generate 
exceptions.  That is, if I were to change anything here, it would be the result 
of the multiplication, not the result of the ** operation.  IMO, numerically 
naive users shouldn't be exposed to infinities and NaNs; they should get 
exceptions for invalid inputs instead.  The math and cmath modules fairly 
rigorously follow this idea, but as you've discovered the built-in operators 
aren't so consistent.

Fixing it without breaking existing code and without annoying existing users is 
tricky, though.

----------
nosy: +mark.dickinson

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

Reply via email to