Boost logo

Boost :

From: Jason D Schmidt (jd.schmidt_at_[hidden])
Date: 2002-09-26 23:28:54


Hi everyone,

Not too long ago, I asked people on this list if anyone was interested in
having math & physics values incorporated into Boost. Some people
sounded interested, so here's what I'm proposing:

template <class value_type>
struct math_vals
{
    static value_type pi()
    { return value_type(3.14); } // I'll use more digits
    static value_type e()
    { return value_type(2.72); }
    // more math values
};

Something like that. I'll get the actual values from a reliable
reference and use as many digits as possible. I figure this is pretty
simple, efficient, & portable. Maybe if someone thinks this is a little
verbose, he/she could do something like this in user code:
    const float e = math_vals<float>::e();

I could also do the same thing with physics-related values, like speed of
light, Planck's constant, & more. However, those all have units, so
their values depend on what system we're using. Would we want to just
stick with SI units? Or might we want to have another struct for cgs
(esu) units? Or would we want to have a units class that acts something
like a policy?

Does anyone have any thoughts on the general design I've proposed above
or anything else?

Jason Schmidt

________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today! For your FREE software, visit:
http://dl.www.juno.com/get/web/.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk