|
Boost : |
From: David Abrahams (abrahams_at_[hidden])
Date: 2001-04-19 15:52:01
Hmm, in trying to weigh the relative importances of things, I think that
accuracy comes out way ahead of the ability to do some kind of compile-time
deduction on floating constants which have been converted to integer
expressions. Can you give an argument for the utility of the latter?
-Dave
----- Original Message -----
From: "Ed Brey" <brey_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, April 19, 2001 4:18 PM
Subject: [boost] Re: Boost.MathConstants: Review
> --- In boost_at_y..., "David Abrahams" <abrahams_at_m...> wrote:
> > I'm not sure that's true. Just because SOME compilers can change the
> > representation of floating point numbers at runtime doesn't mean
> that all of
> > them can. Isn't it possible that some compiler will be able to
> embed a
> > floating constant in the source code and avoid hitting data memory
> to look
> > it up?
>
> Coincidentally, I just ran into a case where inline makes the
> difference when verifing that it is non-bloaty to put all the
> functions in a single header. As an example, the code:
>
> int main() {return int(boost::math::constants<float>::pi());}
>
> causes VC6 to the same code as a simple "return 3;" In general,
> having the constant in the same translation unit is useful any time
> the compiler can figure out something at compile time, like
> c::e() / 16.
>
>
>
> 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