Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70296 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84696 invoked from network); 22 Nov 2013 21:37:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Nov 2013 21:37:37 -0000 Authentication-Results: pb1.pair.com header.from=theanomaly.is@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=theanomaly.is@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.181 as permitted sender) X-PHP-List-Original-Sender: theanomaly.is@gmail.com X-Host-Fingerprint: 74.125.82.181 mail-we0-f181.google.com Received: from [74.125.82.181] ([74.125.82.181:50094] helo=mail-we0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7F/80-28674-E9ECF825 for ; Fri, 22 Nov 2013 16:37:36 -0500 Received: by mail-we0-f181.google.com with SMTP id x55so1746447wes.12 for ; Fri, 22 Nov 2013 13:37:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=E3dWlTSM+vPSdQ/oYRuMqmrsarwx5Q8gaBGqfnmiDnM=; b=OUIy9RMxSPuM3XWSMUERLqwI6n9bpyCMvAKkfxgRMTsFeilp1cjCcjGvDGEDNNaxZY LewLI+wz4qjP8ofjxzzS1oEr1DJw2s0CQCQOf+OSyBjDii9P20KoJJbuAw5gICI3lMAB qCqgnalGBpxm47VxZvG5lTfZ9t7/v2c8R7I6KQ/KmxT1pk2l6Utcv3GNNmXjzNFuKpRM boF2S3gQvtTBiSCIxRDqsLiuvx5zfYrZZi5nsMN4Sm/Z5cGCeH+PNrkX4rAiWKwwQ7+o t4EJO2pC9K6hRFCtgNmS0VNLK9+nFht60diJdtGGaJkxTA5gXIOrYO2R/WypUbYZJ0qt fLJA== MIME-Version: 1.0 X-Received: by 10.180.183.72 with SMTP id ek8mr4363674wic.49.1385156252200; Fri, 22 Nov 2013 13:37:32 -0800 (PST) Received: by 10.227.134.196 with HTTP; Fri, 22 Nov 2013 13:37:32 -0800 (PST) In-Reply-To: References: Date: Fri, 22 Nov 2013 16:37:32 -0500 Message-ID: To: Chris London Cc: Tjerk Meesters , Leigh , PHP Internals Content-Type: multipart/alternative; boundary=001a11c3556e5ef39d04ebcad281 Subject: Re: [PHP-DEV] Power function as operator From: theanomaly.is@gmail.com (Sherif Ramadan) --001a11c3556e5ef39d04ebcad281 Content-Type: text/plain; charset=ISO-8859-1 On Fri, Nov 22, 2013 at 4:06 PM, Chris London wrote: > > On Fri, Nov 22, 2013 at 12:56 PM, Sherif Ramadan wrote: > >> On Fri, Nov 22, 2013 at 1:03 PM, Tjerk Meesters > >wrote: >> >> > >> > 2 ** 3 ** 2 == 512 >> > >> >> >> That looks very wrong. pow(pow(2,3),2) == 64 >> >> Exponent precedence should always be one higher than multiplication >> precedence. >> > > I don't know if we consider Google to be the authority but they also do > 512: > > 2 ^ 3 ^ 2 = 512 > > https://www.google.com/search?q=2+%5E+3+%5E+2 > > Well, it's correct in the sense that ** should be a right-associative operator (and as such Python will provide the same result). The get the same effect as pow(pow(2,3),2), one would have to do ((2**3)**2), in which case the result woudl be 64. I just didn't realize the patch made the operator right-associative until now. --001a11c3556e5ef39d04ebcad281--