|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-10-24 13:37:36
From: "Noah Stein" <noah_at_[hidden]>
> > I don't really see what's wrong with the simple
> >
> > namespace math
> > {
> > double const pi = 3.14159265358...;
> > }
>
> For me, it's an enormous burden. I work on hardware that only supports
> floats. I'd have to cast the constants every time I use them.
Why?
float const pi_f = math::pi;
> In addition to floats, though, I also used fixed point formats frequently,
> so a system that supports multiple type defintions for constants is a
great
> thing. I'd have almost no option but to use a runtime conversion for a
> double constant to a fixed-point. Maybe I'm being selfish, but I like the
> other way. :)
Ditto:
fixed<16, 16> const pi_x16 = math::pi;
Dynamic init may be somewhat painful at times, I admit, but you can't expect
boost to generate the constants in every custom format, can you? It can only
provide a common framework into which you'd fill the constants in your fixed
point format.
What is the value of this framework?
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk