Re: New proposal for math.e
Derek Parnell wrote:
>
> Colin Taylor wrote:
> > Very nice. First I would suggest adding a constant RADIANS =
> > 57.29577951308232158
> > and modifying radians_to_degrees() and degrees_to_radians() as follows:
> >
> > }}}
<eucode>
> >
> > global function radians_to_degrees (object x)
> > return x * RADIANS
> > end function
> >
> > global function degrees_to_radians (object x)
> > return x / RADIANS
> > end function
> >
> > </eucode>
{{{
>
> Good suggestion. And even better would be to avoid the division as well.
>
>
> }}}
<eucode>
> constant RADIANS_DEGREES = 57.29577951308232158
> constant DEGREES_RADIANS = 0.017453292519943296
> global function radians_to_degrees (object r)
> return r * RADIANS_DEGREES
> end function
>
> global function degrees_to_radians (object d)
> return d * DEGREES_RADIANS
> end function
> </eucode>
{{{
>
>
> --
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell
Hmm. On modern hardware does it really matter? Especially in the context of an
interpreted language?
Not trying to nitpick, I'm just curious. I think the most obvious solution is
the best, and both of these qualify.
--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.
|
Not Categorized, Please Help
|
|