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" <[EMAIL PROTECTED]>
To: "Kalle Sommer Nielsen" <[EMAIL PROTECTED]>
Cc: "Guilherme Blanco" <[EMAIL PROTECTED]>; "PHP Developers Mailing List" <internals@lists.php.net>
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"
> <[EMAIL PROTECTED]>
> To: "Kalle Sommer Nielsen" <[EMAIL PROTECTED]>
> Cc: "PHP Developers Mailing List" <internals@lists.php.net>
> 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
>> <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
>> 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: [EMAIL PROTECTED]    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






--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to