Message210523
> 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. |
|
Date |
User |
Action |
Args |
2014-02-07 18:54:29 | mark.dickinson | set | recipients:
+ mark.dickinson, Keith.Randall |
2014-02-07 18:54:29 | mark.dickinson | set | messageid: <1391799269.88.0.917397410242.issue20543@psf.upfronthosting.co.za> |
2014-02-07 18:54:29 | mark.dickinson | link | issue20543 messages |
2014-02-07 18:54:29 | mark.dickinson | create | |
|