Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70767 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24660 invoked from network); 19 Dec 2013 22:17:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Dec 2013 22:17:14 -0000 Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lsces.co.uk from 217.147.176.204 cause and error) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 217.147.176.204 mail4.serversure.net Linux 2.6 Received: from [217.147.176.204] ([217.147.176.204:37186] helo=mail4.serversure.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 40/DD-42949-86073B25 for ; Thu, 19 Dec 2013 17:17:13 -0500 Received: (qmail 3543 invoked by uid 89); 19 Dec 2013 22:17:09 -0000 Received: from unknown (HELO linux-dev4.lsces.org.uk) (lester@rainbowdigitalmedia.org.uk@81.138.11.136) by mail4.serversure.net with ESMTPA; 19 Dec 2013 22:17:09 -0000 Message-ID: <52B370F4.5010909@lsces.co.uk> Date: Thu, 19 Dec 2013 22:19:32 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0 SeaMonkey/2.22 MIME-Version: 1.0 To: internals@lists.php.net References: <52B36BFC.4080708@lerdorf.com> In-Reply-To: <52B36BFC.4080708@lerdorf.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: power operator (again) From: lester@lsces.co.uk (Lester Caine) Rasmus Lerdorf wrote: > On 12/19/2013 04:50 PM, Kris Craig wrote: >> I believe that, especially for a KISS language like PHP, our top priority >> with math operators should be to match arithmetic laws as closely and as >> intuitively as possible. The average PHP developer is going to do -3 ** 2 >> and expect a result of 9, not -9, and rightly so I think. > > No, the average PHP developer is going to do $var ** 2 and it will > behave exactly as they expect with negative values. Yes, in the very > rare case that someone for some reason hardcodes a negative literal > there, they are going to have to learn about operator precedence because > we really can't have 0 - 3**2 be different from - 3**2. The only way to ensure you get what YOU expect is to add the missing brackets to any equation ... - (3**2) is simply not the same as (- 3)**2 but '-3' should always be (-3) the space has a significance in this case as far as I am concerned. All of this needs the proper inclusion of the brackets since you can't always remember which alternate is being used anyway ... -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk