2**2**2**2**2 wrong? Bug?

Jim Langston tazmaster at rocketmail.com
Tue Jul 10 08:54:14 CEST 2007


Gah!  Python goes right to left?  Dang, I haven't seen that since APL.

<brianjiang at gdnt.com.cn> wrote in message 
news:mailman.512.1184044672.22759.python-list at python.org...
>>> ((((2**2)**2)**2)**2)
65536

>>> 2**(2**(2**(2**2)))
200352993040684646497907235156025575044782547556975141926501697371089405955631145308950613088.............................................
The same as "2**2**2**2**2"



-----Original Message-----
From: python-list-bounces+brianjiang=gdnt.com.cn at python.org 
[mailto:python-list-bounces+brianjiang=gdnt.com.cn at python.org] On Behalf Of 
Jim Langston
Sent: 2007Äê7ÔÂ10ÈÕ 12:47
To: python-list at python.org
Subject: Re: 2**2**2**2**2 wrong? Bug?

"Paul Rubin" <http://phr.cx@NOSPAM.invalid> wrote in message 
news:7xbqek7ty1.fsf at ruckus.brouhaha.com...
> "Jim Langston" <tazmaster at rocketmail.com> writes:
>> In Python 2.5 on intel, the statement
>> 2**2**2**2**2
>> evaluates to
>> >>> 2**2**2**2**2
>
> I get the same number from hugs--why do you think it might be wrong?

2**2 = 4
4**2 = 16
16**2 = 256
256**2 = 65536
65536**2 = 4294967296

In fact, if I put (2**2)**2**2**2
it comes up with the correct answer, 4294967296






More information about the Python-list mailing list