Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70315 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29464 invoked from network); 23 Nov 2013 05:35:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Nov 2013 05:35:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.170 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.128.170 mail-ve0-f170.google.com Received: from [209.85.128.170] ([209.85.128.170:45883] helo=mail-ve0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5E/15-00832-FAE30925 for ; Sat, 23 Nov 2013 00:35:43 -0500 Received: by mail-ve0-f170.google.com with SMTP id oy12so1618047veb.1 for ; Fri, 22 Nov 2013 21:35:40 -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=wPXcGmV5hwKWFgD+DoHfDEi8XhcffL9xZV7sK7p8uvQ=; b=RRdnXQhUa2s/PPCxfyJ1iLd4zaus5Pc/dtFevKnJZgkSZyzCN3+ZXqSbQCcBdBpCcm 3LxmPclp/+UxbxY29f6585e8Ck2ancNhdSbyC/4ho9qpNxZ1kDUe7MqE23gp9/2R7B9n lujWW3s8UGUaQCmfrhd/67t7SJmkCy+q23ogzWt01XkkmCCtjA9Rk9GdC2QCrVCkA/Cs zizd78V0PDcBLkQJyP5PDDcjckZh+WmzFPICrxGJpxVaXw5gQRwsr8zmjacwEF+xTNn0 YEzFh+u7KD3/S1Kfd1DTQdzCtoEcEvKCEW1FzD4bKQOIOdtTR4eiXDZRrRkdidHx0OlS 0CKw== MIME-Version: 1.0 X-Received: by 10.220.174.200 with SMTP id u8mr15084531vcz.6.1385184940174; Fri, 22 Nov 2013 21:35:40 -0800 (PST) Received: by 10.58.128.33 with HTTP; Fri, 22 Nov 2013 21:35:40 -0800 (PST) In-Reply-To: <528FB534.6000605@ajf.me> References: <528FB534.6000605@ajf.me> Date: Sat, 23 Nov 2013 13:35:40 +0800 Message-ID: To: Andrea Faulds Cc: PHP Internals Content-Type: multipart/alternative; boundary=089e0149ca3a4eb50304ebd18034 Subject: Re: [PHP-DEV] Power function as operator From: tjerk.meesters@gmail.com (Tjerk Meesters) --089e0149ca3a4eb50304ebd18034 Content-Type: text/plain; charset=ISO-8859-1 Hi Andrea, On Sat, Nov 23, 2013 at 3:49 AM, Andrea Faulds wrote: > > > On 22/11/13 16:58, Tjerk Meesters wrote: > >> >> It introduces the pow() function as an operator ** (double asterisk), as >> can be found in languages such as Python (with perhaps the notable >> difference that it's right associative there). >> >> > This is great! I like Python's ** operator and having it in PHP would be > great too. It's a very versatile mathematical operator. With ** you get > three for the price of one: You can do powers ($x ** 2), you can do square > roots ($x ** (1/2)) and you can do reciprocals ($x ** -1), though for that > last one there was already 1 / $x. > > I will definitely vote for this proposal if it works and you make an RFC. > > I do have one concern, however. It looks like your current pull request > doesn't make gmp support it. Nikita's (nikic) proposal to add internal > operator overloading so that the gmp library could support it has been > merged in. So could you make it overloadable (if it isn't already), and > make sure gmp supports it? > Sure, gmp has gmp_pow(), so I don't think it will be a huge problem to support this :) > > Thanks! > -- > Andrea Faulds > http://ajf.me/ > -- -- Tjerk --089e0149ca3a4eb50304ebd18034--