[issue41205] Documentation Decimal power 0 to the 0 is Nan (versus 0 to the 0 which is 1)

JD-Veiga report at bugs.python.org
Fri Jul 3 18:51:25 EDT 2020


New submission from JD-Veiga <jdveiga at gmail.com>:

Hi,

I would like to propose a minor addition to `decimal` package documentation page (https://docs.python.org/3/library/decimal.html). I think that we should add a paragraph in `context.power(x, y, modulo=None)` stating that `Decimal(0) ** Decimal(0)` returns `Decimal('NaN')` instead of `1` --as `0 ** 0` does-- or `1.0` --in case of `0.0 ** 0.0`.

Indeed, `0 ** 0` is `NaN` is mentioned as example of operations raising `InvalidOperation` exceptions.

However, I think that this is not enough to indicate the different behaviour of decimal versus int and float numbers.

Moreover, in the case of `%` and `//` operators, there are clear remarks on these differences (See: “There are some small differences between arithmetic on Decimal objects and arithmetic on integers and floats [...]” in the page).

Thank you and sorry for the inconvenience.

----------
assignee: docs at python
components: Documentation
messages: 372969
nosy: JD-Veiga, docs at python
priority: normal
severity: normal
status: open
title: Documentation Decimal power 0 to the 0 is Nan (versus 0 to the 0 which is 1)
type: enhancement
versions: Python 3.10, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41205>
_______________________________________


More information about the Python-bugs-list mailing list