Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37766 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77346 invoked from network); 21 May 2008 02:13:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 May 2008 02:13:33 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 204.11.219.139 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 204.11.219.139 mail.lerdorf.com Received: from [204.11.219.139] ([204.11.219.139:59187] helo=mail.lerdorf.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FD/70-07862-A4583384 for ; Tue, 20 May 2008 22:13:32 -0400 Received: from [192.168.200.148] (c-24-6-219-206.hsd1.ca.comcast.net [24.6.219.206]) (authenticated bits=0) by mail.lerdorf.com (8.14.3/8.14.3/Debian-1) with ESMTP id m4L2DPN6025300; Tue, 20 May 2008 19:13:26 -0700 Message-ID: <48338545.8050904@lerdorf.com> Date: Tue, 20 May 2008 19:13:25 -0700 User-Agent: Thunderbird 2.0.0.4 (Macintosh/20070604) MIME-Version: 1.0 To: Kalle Sommer Nielsen CC: Christopher Jones , Guilherme Blanco , PHP Developers Mailing List References: <4D0F5827906C42F69F16798598186754@KALLESAWESOMEPC> <483379DD.90307@oracle.com> In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-3.0 (mail.lerdorf.com [204.11.219.139]); Tue, 20 May 2008 19:13:26 -0700 (PDT) Subject: Re: [PHP-DEV] Add deg2grad() and grad2deg() in PHP5.3 From: rasmus@lerdorf.com (Rasmus Lerdorf) I think it is a bad idea to add functions for such a trivial math operation. It's not like people who need to do this can't do it today, and people who have already written code that needs it may very well have created userspace functions with these exact names which means their code will break when they upgrade PHP. I bet the number of people we piss off with this is greater than the number of people who will appreciate this tiny addition. -Rasmus Kalle Sommer Nielsen wrote: > Hi Chris > > I didn't think of making an RFC for this mainly because its so small and > one of the > only use cases I could see would be the same as I see for rad2deg() and > deg2rad(). > > And yes theres probably overflow and underflow just like in a couple of > the other math > functions. In my small perfect world I would do a check and add a > warning or notice for > incorrect values but Im sure that most around here wouldn't agree with > that part ;) > > Kalle > > ----- Original Message ----- From: "Christopher Jones" > > To: "Kalle Sommer Nielsen" > Cc: "Guilherme Blanco" ; "PHP Developers > Mailing List" > Sent: Wednesday, May 21, 2008 3:24 AM > Subject: Re: [PHP-DEV] Add deg2grad() and grad2deg() in PHP5.3 > > >> >> Even for small projects like this, we should get into the habit of >> creating an RFC on the Wiki. >> >> This is a way to explain the pros & cons so the functionality can be >> evaluated. You can argue about the algorithm choice and point out >> weakness (overflow/underflow?). It allows us to see where the code >> will be added, and lets us see some usecases (that will become tests) >> etc. >> >> Chris >> >> Kalle Sommer Nielsen wrote: >> > Ah Cheers >> > >> > I didn't think of number optimizations, but its done now >> > >> > Cheers >> > Kalle >> > >> > >> > ----- Original Message ----- From: "Guilherme Blanco" >> > >> > To: "Kalle Sommer Nielsen" >> > Cc: "PHP Developers Mailing List" >> > Sent: Tuesday, May 20, 2008 8:47 PM >> > Subject: Re: [PHP-DEV] Add deg2grad() and grad2deg() in PHP5.3 >> > >> > >> >> Hi... >> >> >> >> Are there any explanation why you used 360 and 400 and not optimized >> >> it? I know 1 full circle = 360 deg = 400 grads, but you can simplify >> >> it to: >> >> >> >> RETURN_DOUBLE((9 / 10) * deg); >> >> >> >> and... >> >> >> >> RETURN_DOUBLE((10 / 9) * grads); >> >> >> >> >> >> Regards, >> >> >> >> On Tue, May 20, 2008 at 3:22 PM, Kalle Sommer Nielsen >> >> wrote: >> >>> Greetings internals >> >>> >> >>> I've made two functions that allows convertion between degress and >> >>> gradians, >> >>> below is a pastebin >> >>> of the functions as that would look in math.c: >> >>> http://www.phpfi.com/318450 >> >>> >> >>> If no objections against it I will commit them in PHP_5_3 and HEAD >> and >>> I >> >>> will prepare some test >> >>> cases for those aswell. >> >>> >> >>> >> >>> Cheers >> >>> Kalle >> >>> >> >>> -- >> >>> PHP Internals - PHP Runtime Development Mailing List >> >>> To unsubscribe, visit: http://www.php.net/unsub.php >> >>> >> >>> >> >> >> >> >> >> >> >> -- >> >> Guilherme Blanco - Web Developer >> >> CBC - Certified Bindows Consultant >> >> Cell Phone: +55 (16) 9166-6902 >> >> MSN: guilhermeblanco@hotmail.com >> >> URL: http://blog.bisna.com >> >> Rio de Janeiro - RJ/Brazil >> >> >> >> >> >> >> >> >> >> -- >> >> No virus found in this incoming message. >> >> Checked by AVG. >> >> Version: 7.5.524 / Virus Database: 269.23.21/1455 - Release Date: >> >> 19-05-2008 17:04 >> >> >> >> >> > >> > >> >> -- >> Christopher Jones, Oracle >> Email: christopher.jones@oracle.com Tel: +1 650 506 8630 >> Blog: http://blogs.oracle.com/opal/ Free PHP Book: >> http://tinyurl.com/f8jad >> >> >> >> >> -- >> No virus found in this incoming message. >> Checked by AVG. Version: 7.5.524 / Virus Database: 269.23.21/1455 - >> Release Date: 19-05-2008 17:04 >> >> > >