Boost logo

Boost :

From: Daryle Walker (dwalker07_at_[hidden])
Date: 2003-08-12 02:56:10


[Paul claims that lexical_cast prints (floating-point) numbers with too
few precision digits. Currently, limits::digits10 + 1 is used. Paul
wants to change it to "int significant_digits10 = int(ceil(1 +
limits::digits * log10Two));" where "limits" is the numeric-limits
traits class and "log10Two" is the base-10 logarithm of 2.]

You used an article on IEEE 754 arithmetic. Shouldn't you check if the
number type is compliant with that format? Or can this work for any
suitable type? You also have to check if "limits::digits" is 2!

Looking at the numbers you had, couldn't you just change
"limits::digits10 + 1" to "limits::digits10 + 3"? It could be argued
that there's just a bug in the definitions of "limits::digits10" (it's
too low).

On Saturday, August 9, 2003, at 5:48 PM, Paul A. Bristow wrote:
[CHOP OFF really long article, with long attachments]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk