Message372982
I agree that the result is surprising and should be noted in the docs; we shouldn't expect all the decimal users to be familiar with the specification. Some of the other differences with float arithmetic *are* noted (e.g., the behaviour of `//` and `%`), but apparently not this one. We do document the behaviour of these corner cases for `math.pow`.
The part that I find really odd is that the specification says that `Decimal("inf")**Decimal(0)` is `1`. Treating one of 0**0 and inf**0 as undefined but not the other seems inconsistent to me. We'd probably want to note the behaviour of inf**0 in the docs, too. (I tried to argue with Mike Cowlishaw about this, but I lost.)
I'm not sure whether just noting this in the "power" documentation is enough: it's not clear to me that users using the ** operator would think to check the docs for the "power" method.
The other weirdly non-IEEE 754 behaviour (again, mandated by the standard) that bugs me from time to time is that the unary `-` and `+` operators will never give negative zero: Decimal("-0.0") and -Decimal("0.0") are not the same thing. That one's probably worth noting, too. |
|
Date |
User |
Action |
Args |
2020-07-04 07:16:30 | mark.dickinson | set | recipients:
+ mark.dickinson, tim.peters, rhettinger, facundobatista, skrah, docs@python, JD-Veiga |
2020-07-04 07:16:30 | mark.dickinson | set | messageid: <1593846990.78.0.367854055737.issue41205@roundup.psfhosted.org> |
2020-07-04 07:16:30 | mark.dickinson | link | issue41205 messages |
2020-07-04 07:16:30 | mark.dickinson | create | |
|