Mark Dickinson <[email protected]> added the comment:
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.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue41205>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com