Boost logo

Boost :

From: Ed Brey (brey_at_[hidden])
Date: 2001-04-19 15:18:39

--- 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.

Boost list run by bdawes at, gregod at, cpdaniel at, john at