|
Boost : |
From: Caleb Epstein (caleb.epstein_at_[hidden])
Date: 2006-03-17 10:12:48
On 3/17/06, Paul A Bristow <pbristow_at_[hidden]> wrote:
>
> Ooops - this is a typo.
>
> It should of course be 3010/10000.
Which is one of the reasons magic numbers in code are best avoided. It sure
would be nice if one could just use numeric_limits<T>::digits10 + 2 instead
of numeric_limits<T>::digits * 3010 / 10000, but the former gives a
different result for float (8 instead of 9).
Perhaps this cryptic calculation might be best addressed by a
boost::numeric_limits<T> which could extend std::numeric_limits<T> and
include Paul Bristow's proposed max_digits10 (see
http://www2.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf)?
-- Caleb Epstein caleb dot epstein at gmail dot com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk