Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70359 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64772 invoked from network); 24 Nov 2013 20:58:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Nov 2013 20:58:39 -0000 Authentication-Results: pb1.pair.com header.from=rewilliams@thesba.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rewilliams@thesba.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain thesba.com designates 208.106.205.210 as permitted sender) X-PHP-List-Original-Sender: rewilliams@thesba.com X-Host-Fingerprint: 208.106.205.210 unknown Received: from [208.106.205.210] ([208.106.205.210:19264] helo=ntsexchedgea1.newtekemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D3/82-51929-D7862925 for ; Sun, 24 Nov 2013 15:58:38 -0500 Received: from NTSEXCHHUBA1.NTS.PHX1 (208.106.205.208) by NTSEXCHEDGEA1.newtekemail.com (208.106.205.210) with Microsoft SMTP Server (TLS) id 8.3.137.0; Sun, 24 Nov 2013 13:58:10 -0700 Received: from NTSEXCHA1CMB2.NTS.PHX1 ([fe80::1c54:1501:a334:b20a]) by NTSEXCHHUBA1.NTS.PHX1 ([2002:d06a:cdd0::d06a:cdd0]) with mapi; Sun, 24 Nov 2013 13:58:27 -0700 To: Pierre Joye CC: Chris London , Tjerk Meesters , PHP Internals Date: Sun, 24 Nov 2013 13:58:24 -0700 Thread-Topic: [PHP-DEV] Re: rfc: pow-operator Thread-Index: Ac7pV+su1xrzBIlqQRSfbtpTNt4Kkw== Message-ID: <2CBED69B-2859-4F70-A56D-27281EBED4CE@newtekemail.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [PHP-DEV] Re: rfc: pow-operator From: rewilliams@thesba.com (Robert Williams) > On Nov 24, 2013, at 8:57, "Pierre Joye" wrote: > > it not be possible to do something similar than isset? Changing > pow from a function to operator? The big advantage is that any > existing code will benefit from it without code changes. Personally, I'd much rather see another operator introduced since it more c= losely mirrors what we do in written math, which makes conversion and valid= ation easier. Some simple examples: $area =3D M_PI * $radius**2 Instead of this: $area =3D pow(M_PI * $radius, 2) $pv =3D $fv / (1 + $i)**$n Instead of this: $pv =3D $fv / pow(1 + $i, $n) $c =3D sqrt($c1**2 + $c2**2) Instead of this: $c =3D sqrt(pow($c1, 2) + pow($c2, 2)) When you start throwing in nested exponents, the nested pow() calls just ge= t that much messier. As for existing code (and new code where people will inevitably use pow()),= can the function call be optimized away? I know PHP doesn't do heavy optim= izations because it happens at runtime, but is this conversion within the r= ealm of what it can do? -- Bob Williams Notice: This communication, including attachments, may contain information = that is confidential. It constitutes non-public information intended to be = conveyed only to the designated recipient(s). If the reader or recipient of= this communication is not the intended recipient, an employee or agent of = the intended recipient who is responsible for delivering it to the intended= recipient, or if you believe that you have received this communication in = error, please notify the sender immediately by return e-mail and promptly d= elete this e-mail, including attachments without reading or saving them in = any manner. The unauthorized use, dissemination, distribution, or reproduct= ion of this e-mail, including attachments, is prohibited and may be unlawfu= l. If you have received this email in error, please notify us immediately b= y e-mail or telephone and delete the e-mail and the attachments (if any).