This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients JD-Veiga, docs@python, facundobatista, mark.dickinson, rhettinger, skrah, tim.peters
Date 2020-07-04.07:16:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1593846990.78.0.367854055737.issue41205@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-07-04 07:16:30mark.dickinsonsetrecipients: + mark.dickinson, tim.peters, rhettinger, facundobatista, skrah, docs@python, JD-Veiga
2020-07-04 07:16:30mark.dickinsonsetmessageid: <1593846990.78.0.367854055737.issue41205@roundup.psfhosted.org>
2020-07-04 07:16:30mark.dickinsonlinkissue41205 messages
2020-07-04 07:16:30mark.dickinsoncreate