Boost logo

Boost :

From: Jason D Schmidt (jd.schmidt_at_[hidden])
Date: 2002-09-27 08:20:25


Date: Thu, 26 Sep 2002 22:38:38 -0700
From: "Victor A. Wagner, Jr." <vawjr_at_[hidden]>
To: boost_at_[hidden]
Subject: Re: [boost] math values
Message-ID: <4.3.1.2.20020926223349.01ed8e90_at_[hidden]>
In-Reply-To: <20020926.222854.3672.1.jd.schmidt_at_[hidden]>
Content-Type: text/plain; charset="us-ascii"; format=flowed
MIME-Version: 1.0
Precedence: bulk
Message: 22
 
At Thursday 2002/09/26 21:28, you wrote:
>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?
 
if you're going to play with physics stuff, have you given any thought to

doing Barton & Nackman's templated approach to tracking m, l, and t? It
was mentioned in Scott Meyers forward to Andrei Alexandrescu's book.
 
Should that be attempted, then we could (of course) include the
measurement
system (and possibly even convert automagically between them).
 
That has been a 'dream' of mine ever since I first saw "object oriented"
 
 
>Jason Schmidt
>

I just ordered Alexandrescu's book, so I'll look into it when I get it.
As far as Barton & Nackman goes, I haven't read the book, but I know what
the "Barton-Nackman trick" is. What is his templated approach to m, l, &
t ? It sounds interesting.

Jason

________________________________________________________________
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