I like using either UPPER CASE or CamelCase, to distinguish from other  
scalars.

I suggest at least:

        Pi      3.14159265358979....
        RaDeg   Pi/180
        RaMin   Pi/180/60
        RaSec   Pi/180/3600
        SecPerHour      3600
        SecPerDay       86400
        SecPerYear      31557600
        E               2.7182818284590452.... (How do you put CamelCase on e? 
All caps?)
        Ln2             0.6931471805599453.... (for HWHM conversion with 
Gaussians)

I like the idea of just putting them in scalars (perhaps as 0- 
dimensional PDLs?) for the low access overhead (subs or objects can  
get quite expensive). Memory is free on that scale these days. (who  
needs log(2) in a toaster?)

Most of the other magic numbers I end up using seem to be unit  
conversions, thus not relevant here...

        
        

On May 2, 2010, at 6:46 AM, Chris Marshall wrote:

> I was reviewing outstanding issues for our
> upcoming PDL CPAN developers release and
> came upon:
>
>   
> http://sourceforge.net/tracker/?func=detail&aid=2787823&group_id=612&atid=350612
>
> regarding adding basic math constants to PDL.
>
> If you have any numerical constants you calculate
> to use with PDL and any preference on their
> implementation style (sub, scalar, object,...)
> please rsvp to the list for discussion.
>
> e.g.
>
> I'm always calculating Pi
>
> I prefer a perl scalar implementation
> so I don't have to play games with
> string interpolation.
>
> Lower case is nice for ease of
> typing.  Upper case is useful in
> that "constants" are often upcased
> a la C macros.
>
>
> Thanks,
> Chris
>
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>


_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to