Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-07-23 09:55:50

----- Original Message -----
From: "John Maddock" <John_Maddock_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, July 23, 2000 7:28 AM
Subject: [boost] math constants

> 3) In the definition of math_const<float> you have:
> static const T sqrt_two() _THROW0()
> { return
> static_cast<T>(1.41421356237309504880168872420969807857L); }
> I think that I'm correct in saying that the value here will be rounded
> twice - once on decimal to binary conversion (to a long double), and then
> once again on conversion to float. However, some compilers will not do
> second rounding (though according to the standard they should) and instead
> return the long double value. Whatever you may want to check your
> suffixes.

What is the alternative to rounding to float taken by the non-conforming
compilers in this case? The return type is float, so the long double needs
to be converted at some point. I believe the static_cast<> is just there to
suppress warnings.


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