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
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
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
Changes by Akima m...@aki.ma:
--
components: +Library (Lib)
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22306
___
___
Python-bugs-list mailing
Changes by Antoine Pitrou pit...@free.fr:
--
nosy: +skrah
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22306
___
___
Python-bugs-list mailing
Changes by Antoine Pitrou pit...@free.fr:
--
nosy: +facundobatista, mark.dickinson, rhettinger
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22306
___
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()
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
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.
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
10 matches
Mail list logo