Thread overview | |||||
---|---|---|---|---|---|
|
April 01, 2008 Feature requests | ||||
---|---|---|---|---|
| ||||
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 Re: Feature requests | ||||
---|---|---|---|---|
| ||||
Posted in reply to Spacen Jasset | 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 Re: Feature requests | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | 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
|
Copyright © 1999-2021 by the D Language Foundation