
On Fri, Apr 29, 2011 at 10:30 PM, Alexander Belopolsky <alexander.belopolsky@gmail.com> wrote:
The choices made for float operations are more ad-hoc: DivisionByZero is always trapped: [...]
Roughly, the current situation is that math module operations try to consistently follow IEEE 754 exceptions: an IEEE 754 overflow is converted to an OverflowError, while invalid-operation or divide-by-zero signals produce a Python ValueError. Basic arithmetic is another story: ** behaves more-or-less like the math module operations, but the arithmetic operations mainly produce nans or infinities, except that division by zero is trapped. IMO, the ideal (ignoring backwards compatibility) would be to have OverflowError / ZeroDivisionError / ValueError produced wherever IEEE754 says that overflow / divide-by-zero / invalid-operation should be signaled. Mark