Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67889 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61506 invoked from network); 26 Jun 2013 16:11:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jun 2013 16:11:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=j.curcio@icloud.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=j.curcio@icloud.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain icloud.com designates 17.158.161.4 as permitted sender) X-PHP-List-Original-Sender: j.curcio@icloud.com X-Host-Fingerprint: 17.158.161.4 nk11p00mm-asmtp005.mac.com Solaris 10 1203 Received: from [17.158.161.4] ([17.158.161.4:63650] helo=nk11p00mm-asmtp005.mac.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7A/C6-29746-5921BC15 for ; Wed, 26 Jun 2013 12:11:02 -0400 Received: from nk11p00mm-spool004.mac.com ([17.158.161.119]) by nk11p00mm-asmtp005.mac.com (Oracle Communications Messaging Server 7u4-27.04(7.0.4.27.3) 64bit (built Mar 7 2013)) with ESMTP id <0MP00020VCXUVE00@nk11p00mm-asmtp005.mac.com> for internals@lists.php.net; Wed, 26 Jun 2013 16:10:59 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.10.8794,1.0.431,0.0.0000 definitions=2013-06-26_06:2013-06-26,2013-06-26,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=6.0.2-1305010000 definitions=main-1306260108 MIME-version: 1.0 Content-type: multipart/alternative; boundary="Boundary_(ID_j7NAQIJSf3X6l+YFjWEhUQ)" Received: from localhost ([17.158.43.22]) by nk11p00mm-spool004.mac.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTP id <0MP000482CY7N680@nk11p00mm-spool004.mac.com>; Wed, 26 Jun 2013 16:10:55 +0000 (GMT) To: Mike Willbanks Cc: PHP Internals Date: Wed, 26 Jun 2013 16:09:40 +0000 (GMT) X-Mailer: iCloud Mail (1Q) X-Originating-IP: [75.148.10.129] Message-ID: <283c659f-031d-4574-9b6b-f2a345d1af1f@me.com> In-reply-to: Subject: Re: [PHP-DEV] Gauging Interest:RFC to add map() function From: j.curcio@icloud.com (Jeremy Curcio) --Boundary_(ID_j7NAQIJSf3X6l+YFjWEhUQ) Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: quoted-printable >I am curious with something that is so easy; why would you want it in cor= e?=0A=0AA lot of the Math Functions could be considered "so easy".=0A=0Aab= s() could be written out as:=0A=A0 =A0 function abs($n) {=0A=A0 =A0 =A0 =A0= if ($n >=3D 0) return $n;=0A=A0 =A0 =A0 =A0 else return $n*-1;=0A=A0 =A0 = }=0A=0Api() could be replaced by simply setting a global variable equal to= 3.14159265358979=0A=0Afloor() could be written out as:=0A=A0 =A0 function= floor($n) {=0A=A0 =A0 =A0 =A0 $stop =3D strpos($n, '.');=0A=A0 =A0 =A0 =A0= =A0if ($stop !=3D=3D false) return substr($n,0,$stop);=0A=A0 =A0 =A0 =A0 e= lse return $n=0A=A0 =A0 }=0A=0Aceil() could be written out as:=0A=A0 =A0=A0= function ceila($n) {=0A=A0 =A0 =A0 =A0=A0$stop =3D strpos($n, '.');=0A=A0 = =A0 =A0 =A0=A0if ($stop !=3D=3D false)=A0return 1+substr($n,0,$stop);=0A=A0= =A0 =A0 =A0=A0else return $n;=0A=A0 =A0 }=0A=0AThe above examples are jus= t a few that stick out to me I'm sure that looking through the list of ava= ilable math functions would provide a few more examples. Keeping these exa= mples in mind, I don't follow the logic of range mapping being too easy to= =A0implement=A0manually whenever it is needed to not warrant being include= d in core.= --Boundary_(ID_j7NAQIJSf3X6l+YFjWEhUQ) Content-type: multipart/related; boundary="Boundary_(ID_8GPOqvdhPfmB5DfgR7TSSw)"; type="text/html" --Boundary_(ID_8GPOqvdhPfmB5DfgR7TSSw) Content-type: text/html; CHARSET=US-ASCII Content-transfer-encoding: quoted-printable
>I am curious with something that is so easy; why would you want it in c= ore?

A lot of the Math Functions could be consi= dered "so easy".

abs() could be written out as:=
&nb= sp;   function abs($n) {
        if ($n >=3D 0) re= turn $n;
        else return $n*-1;
    }

pi() could be= replaced by simply setting a global variable equal to 3.14159265358979

floor() could be written out as:
    fu= nction floor($n) {
        $stop =3D strpos($n, '.');
        if ($stop !=3D=3D false) return substr($n,0,$= stop);
        else return $n<= /div>
  &nbs= p; }

ceil() could be written out as:
  =   function = ceila($n) {
        $stop =3D strpos($n, '.');<= /div>
        if ($stop !=3D=3D false) return 1+substr($n,0,= $stop);
        else return $n;
    }
=
The above examples are just a few that stick out to me I'm sure that look= ing through the list of available math functions would provide a few more = examples. Keeping these examples in mind, I don't follow the logic of rang= e mapping being too easy to implement manually whenever it is ne= eded to not warrant being included in core.
= --Boundary_(ID_8GPOqvdhPfmB5DfgR7TSSw)-- --Boundary_(ID_j7NAQIJSf3X6l+YFjWEhUQ)--