Re: New proposal for math.e

new topic     » goto parent     » topic index » view thread      » older message » newer message

Juergen Luethje wrote:
> 
> Pete Lomax wrote:
> 
> > Derek Parnell wrote:
> > 
> > > constant RADIANS_DEGREES = 57.29577951308232158
> > > constant DEGREES_RADIANS = 0.017453292519943296
> > 
> > I think:
> > 
> > constant RADIANS_TO_DEGREES = 180/PI
> > constant DEGREES_TO_RADIANS = PI/180
> > 
> > is more in keeping with the Eu philosophy.
> 
> And the list of global constants then would look like this:
> }}}
<eucode>
> global constant
>    LN2        = log(2),
>    LN10       = log(10),
>    E          = machine_func(47, {105,87,20,139,10,191,5,64}),    --
>    2.7182818284590452e0
>    SQRT2      = sqrt(2),
>    HALF_SQRT2 = SQRT2/2
>    PI         = machine_func(47, {24,45,68,84,251,33,9,64}),      --
>    3.1415926535897932e0
>    HALF_PI    = PI/2
>    QUARTER_PI = PI/4
>    TWO_PI     = PI*2
> </eucode>
{{{

> I like it. The calculation of the constant values is only done once at
> initialization of the program, so the time for it is negligible, no?
> 
> Regards,
>    Juergen

Doesn't this negate the very purpose of the precision analysis Matt just
performed a couple days ago? The divisions induce rounding errors sometimes, and
that's precisely why he coded all constants using machine_func(47,...).

At least, I'd replace 2 by 2.0 etc, since doubles don't have a native divide by
2 operation, contrary to integers.

By the way, let me add:
EULER_GAMMA = machine_func(47,{25,182,111,252,140,120,226,63})
-- the Euler-Mascheroni-Soldner gamma constant: 0.57721566490153286606065121 
EULER_NORMAL = machine_func(47,{81,54,212,51,69,136,217,63})
-- 1/sqrt(2*PI) = 0.3989422804014326779399461


CChris

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu