Decimals and other numbers

Marko Rauhamaa marko at pacujo.net
Fri Jan 9 04:44:48 EST 2015


Steven D'Aprano <steve+comp.lang.python at pearwood.info>:

> Devin Jeanpierre wrote:
> No you can't -- that would make arithmetic inconsistent. 0**1 is
> perfectly well defined as 0 however you look at it:

You *could* leave 0**1 undefined. You *could* leave 7+0 undefined.
However, that would make mathematical proofs more complex as they would
be riddled with if/else branches.

That's the whole point of silly "no-op" definitions such as a+0 or b**1;
they make mathematical proofs much more concise and feasible. It is
precious to be able to have such "ideal" cases defined, and you'd like
to do it everywhere. Unfortunately, it is not possible everywhere so you
just have to supply the necessary if/else branches in your proof.


Marko



More information about the Python-list mailing list