Thread overview
Feature requests
Apr 01, 2008
Spacen Jasset
Apr 01, 2008
Derek Parnell
Apr 02, 2008
Spacen Jasset
April 01, 2008
I have some features requests, some of which are small. Is there a way that these should be raised?

For example, this trivial feature could go in phobos2.std.math and tango:

float degToRad(float deg)
{
	return deg * PI / 180;
}

float radToDeg(float rad)
{
	return (180 * rad) / PI;
}

April 01, 2008
On Tue, 01 Apr 2008 16:35:30 +0100, Spacen Jasset wrote:

Or maybe ...

enum
{
   fPI_180 = PI / 180.0L;
   f180_PI = 180.0L / PI;
}

T degToRad(T)(T deg)
{
	return cast(T)(cast(real)deg * fPI_180);
}

T radToDeg(T)(T rad)
{
	return cast(T)(cast(real)rad * f180_PI);
}


-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell
April 02, 2008
Derek Parnell wrote:
> On Tue, 01 Apr 2008 16:35:30 +0100, Spacen Jasset wrote:
> 
> Or maybe ...
> 
> enum
> {
>    fPI_180 = PI / 180.0L;
>    f180_PI = 180.0L / PI;
> }
> 
> T degToRad(T)(T deg)
> {
> 	return cast(T)(cast(real)deg * fPI_180);
> }
>  T radToDeg(T)(T rad)
> {
> 	return cast(T)(cast(real)rad * f180_PI);
> }
> 
> 
Yes, thereby giving answers in terms of float, doublt or real. How would that be different from just implementing in terms of real anyway. reals can be implictly converted down to a floats anyway, can they not?

Seems like I should post this to digitalmars.D