| -----Original Message----- | From: [EMAIL PROTECTED] | [mailto:[EMAIL PROTECTED] Behalf Of Daniel Spangenberg | Sent: Tuesday, August 19, 2003 9:25 AM | To: [EMAIL PROTECTED] | Subject: [boost] Re: Insufficient significant digits using lexical_cast |
| I think, the correct solution would be the usage of a constant, similar to | DECIMAL_DIG, which is provided from C99 on. 5.2.4.2.2 says: | | "— number of decimal digits, n, such that any floating-point number | in the widest | supported floating type with pmax radix b digits can be rounded to a | floating-point | number with n decimal digits and back again without change to the value, | | pmax log10 b if b is a power of 10 | Ceil(1 + pmax log10 b) otherwise | | DECIMAL_DIG 10" | | | My personal opinion is: Extend the DECIMAL_DIG definition for any | floating point type, | similar to digits10 I agree (and indeed have previously and now suggested) that adding to numeric_limits:: would be the best solution. But for the time being to 'fix' lexical cast, I think my suggestion, perhaps with Daryle's refinement to warn if not IEE754, is at least better than the existing formula. I will make a further suggestion when I get a moment to test it. Paul Paul A Bristow, Prizet Farmhouse, Kendal, Cumbria, LA8 8AB UK +44 1539 561830 Mobile +44 7714 33 02 04 mailto:[EMAIL PROTECTED] _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost