From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2003-06-18 09:45:18
On Wed, 18 Jun 2003 15:15:24 +0100, "Paul A Bristow"
>Maximum possible accuracy is a central feature,
>promising the best possible portability,
>especially for intervals where every really bit really counts.
>It was also agree that any casting to obtain other types did not
>garanteed accuracy and this was why the proposed code uses namespaces
>to allow selection of the FP size either individually:
In Daniel's solution static_cast<type>(x) simply "selects" the
corresponding specialization of x_value. So
is fundamentally different from, say,
double pi = ...;
>Although your operators are neat, speeding -sin(pi/two),
>my suspicion is that it is better to pre-calculate as many
>constants as possible, and as accurately as possible.
>I don't think this counts as "premature optimisation" :-)
In fact it's not a matter of speed, but of precision. I'm sure there
are compilers where the -sin(pi/2.) in the example code is faster than
-sin(pi/two ). However an overload allows you to specify that the
value of, say, arccos(-1) [math::acos(minus_one)] is exactly pi.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk