|
Boost : |
From: David Abrahams (abrahams_at_[hidden])
Date: 2001-04-22 17:50:34
----- Original Message -----
From: "Ed Brey" <brey_at_[hidden]>
> From: "David Abrahams" <abrahams_at_[hidden]>
> > 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 think at the heart of the matter is the question of the true
requirements
> for Boost.MathConstants. One requirement that I would like to see is that
a
> constant act "just like a float". For many (most?) applications, absolute
> best precision isn't necessary, and is secondary to ease of use (read
> time-to-market), so long as the result still falls in the range of
> "correct". Just having math constants is a great starting point: I don't
> need to dig out a textbook. But even better is to not have to learn a new
> set of rules. I know how floats work, and if I am guaranteed that
(assuming
> a compiler can inline reasonably) the boost constants will operate just
like
> a literal, I can get my job done quickly. The kind of temporary above is
> exactly the type of thing I would want to avoid.
>
> On the other hand, if I need abolute precision, I also wouldn't write an
> expression for four_thirds_pi, but rather would use some mechanism to
> generate the binary value for that expression for each platform my program
> will run on. I would consider this an uncommon case, which is fortunate,
> since it is a lot of work. I certainly don't see any problem with a
> different interface for this quite different usage.
Okay, I buy this argument.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk