Decimals and other numbers

Chris Angelico rosuav at gmail.com
Fri Jan 9 07:34:23 EST 2015


On Fri, Jan 9, 2015 at 11:24 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
>> 5 * 0 * 0 * 0 * 0 = 0
>
> Where did the 5 come from?
>
> You're effectively saying that 0**0 becomes 5*0**0, then cancelling the 0**0
> because they're all zeroes and so don't matter, leaving 5. And that simply
> doesn't work. If it did work, there's nothing special about 5, we could use
> 18 instead:
>
> 0**0 = 5*0**0 => 5
>
> but 0**0 = 18*0**0 => 18
> therefore 5 = 18.
>
> Yay maths! :-)

To clarify, I'm following this sequence:

5 * 0**4 = 5 * 0 * 0 * 0 * 0 = 0
5 * 0**3 = 5 * 0 * 0 * 0 = 0
5 * 0**2 = 5 * 0 * 0 = 0
5 * 0**1 = 5 * 0 = 0
5 * 0**0 = 5 = ?

Multiplication by zero is idempotent; any number of multiplications
beyond the first won't change the result. But that doesn't mean that
never multiplying by zero will have the same result. I think it's
fairly obvious in this example that the pattern does NOT continue to
the case where you're multiplying in no zeroes.

ChrisA



More information about the Python-list mailing list