Boost logo

Boost :

From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2001-04-23 10:08:55


Is the answer to this to have BOTH representations of the same values?

math_constants.hpp

and math_constant_functions.hpp?

Given some fingertip wear, I can generate both.

Paul

> -----Original Message-----
> From: David Abrahams [mailto:abrahams_at_[hidden]]
> Sent: Sunday, April 22, 2001 5:16 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] Re: Boost.MathConstants: Review
>
>
>
> ----- Original Message -----
> From: "Peter Dimov" <pdimov_at_[hidden]>
> > From: "Ed Brey" <brey_at_[hidden]>
> >
> > > AFAICT, it is impossible to have a single interface that
> works for both:
> > > (a) compile-time computation of expressions, and
> > > (b) custom-binary values, which are more accurate than the compiler
> > > can produce.
>
> I think that's right.
>
> > > The user would code like this:
> > >
> > > typedef boost::math::constants c;
> > > or
> > > typedef boost::math::tailored_constants c;
> > >
> > > and then
> > >
> > > r = 4./3. * c::pi() * pow(r,3)
> > > or
> > > r = c::pi() * r * r
>
> I think it might be a reasonable simplification to supply a
> single interface
> and ask the user to write:
>
> double const four_thirds_pi = boost::math::constants<long
> double>::pi() *
> 4./3.;
>
> i.e. manually fold floating-point constant expressions.
>
> > Here's my take on this:
> >
> > // Documented interface
> >
> > namespace boost
> > {
> > float const pi_f;
> > double const pi;
> > long double const pi_l;
> > }
>
> <snip>
>
> > For generic code, this may be supplemented with a numeric_limits-like
> > template, although I think that a static_cast<T>(pi_l) would probably
> > suffice.
>
> If we believe Matt Austern's assertions about rounding, then it
> seems to me
> that the numeric_limits-like template is essential, and it
> shouldn't just be
> a wrapper over the abovve interface.
>
> -Dave
>
>
> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>


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