[issue22306] Inconsistent division by 0 behaviour in decimal module

2014-09-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: Sorry. Scratch my last comment. I see from the docs ( https://docs.python.org/3/library/decimal.html ) vthat the decimal module explicitly references that IBM spec. I imagine that standard python arithmatic doesn't even attempt to conform to this ibm

[issue22306] Inconsistent division by 0 behaviour in decimal module

2014-08-31 Thread Jesús Cea Avión
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22306 ___ ___ Python-bugs-list mailing list

[issue22306] Inconsistent division by 0 behaviour in decimal module

2014-08-30 Thread Akima
New submission from Akima: 1 / 0 (where both numbers are decimal.Decimal) produces a decimal.DivisionByZero exception as I would expect. This is useful. I can use a simple try except block to catch a potential division by zero error in my code. 0 / 0 (where both numbers are

[issue22306] Inconsistent division by 0 behaviour in decimal module

2014-08-30 Thread Akima
Changes by Akima m...@aki.ma: -- components: +Library (Lib) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22306 ___ ___ Python-bugs-list mailing

[issue22306] Inconsistent division by 0 behaviour in decimal module

2014-08-30 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +skrah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22306 ___ ___ Python-bugs-list mailing

[issue22306] Inconsistent division by 0 behaviour in decimal module

2014-08-30 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +facundobatista, mark.dickinson, rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22306 ___

[issue22306] Inconsistent division by 0 behaviour in decimal module

2014-08-30 Thread Stefan Krah
Stefan Krah added the comment: The behavior is according to the specification: http://speleotrove.com/decimal/decarith.html The idea behind it is that 1/0 can be reasonably defined as infinity, whereas 0/0 is undefined. You can see that if you disable the exceptions: c = getcontext()

[issue22306] Inconsistent division by 0 behaviour in decimal module

2014-08-30 Thread Akima
Akima added the comment: Hi skrah. Thanks for the feedback. That specification is interesting. As this IBM spec appears to be a /general/ specification for performing decimal arithmatic and not targetted specifically at Python's decimal arithmatic implementation, I would expect all of

[issue22306] Inconsistent division by 0 behaviour in decimal module

2014-08-30 Thread Akima
Akima added the comment: Sorry. Scratch my last comment. I see from the docs ( https://docs.python.org/3/library/decimal.html ) that the decimal module explicitly references that IBM spec. I imagine that standard python arithmatic doesn't even attempt to conform to this ibm spec.

[issue22306] Inconsistent division by 0 behaviour in decimal module

2014-08-30 Thread Stefan Krah
Stefan Krah added the comment: According to IEEE 754-2008 binary floats should use the same exceptions in this case. 7.2 Invalid operation ... e) division: division(0, 0) or division(∞, ∞) 7.3 Division by zero The divideByZero exception shall be signaled if and only if an exact