
17 Mar
2006
17 Mar
'06
3:12 p.m.
On 3/17/06, Paul A Bristow <pbristow@hetp.u-net.com> 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