Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70297 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86152 invoked from network); 22 Nov 2013 21:40:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Nov 2013 21:40:37 -0000 Authentication-Results: pb1.pair.com header.from=thruska@cubiclesoft.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=thruska@cubiclesoft.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain cubiclesoft.com designates 74.208.44.107 as permitted sender) X-PHP-List-Original-Sender: thruska@cubiclesoft.com X-Host-Fingerprint: 74.208.44.107 u15404699.onlinehome-server.com Received: from [74.208.44.107] ([74.208.44.107:59669] helo=u15404699.onlinehome-server.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 85/E0-28674-F4FCF825 for ; Fri, 22 Nov 2013 16:40:31 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: thruska@cubiclesoft.com) with ESMTPSA id C4C3050000BE Message-ID: <528FCF3A.6020800@cubiclesoft.com> Date: Fri, 22 Nov 2013 14:40:10 -0700 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: PHP Internals References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Power function as operator From: thruska@cubiclesoft.com (Thomas Hruska) On 11/22/2013 2: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 SpeedCrunch also reports 512. It is my current desktop calculator of choice (except for decimal/hex conversions) but it hasn't been updated in a while, which is an indicator of a dead project. IMO, things that "look very wrong" are better written with parenthesis. Parenthesis = clarification. 2 ** (3 ** 2) is probably clearer to read than 2 ** 3 ** 2 even though they have the same result. -- Thomas Hruska CubicleSoft President I've got great, time saving software that you might find useful. http://cubiclesoft.com/