|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r86499 - trunk/boost/archive
From: ramey_at_[hidden]
Date: 2013-10-28 11:34:59
Author: ramey
Date: 2013-10-28 11:34:58 EDT (Mon, 28 Oct 2013)
New Revision: 86499
URL: http://svn.boost.org/trac/boost/changeset/86499
Log:
corrected # digits
Text files modified:
trunk/boost/archive/basic_text_oprimitive.hpp | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
Modified: trunk/boost/archive/basic_text_oprimitive.hpp
==============================================================================
--- trunk/boost/archive/basic_text_oprimitive.hpp Mon Oct 28 06:34:51 2013 (r86498)
+++ trunk/boost/archive/basic_text_oprimitive.hpp 2013-10-28 11:34:58 EDT (Mon, 28 Oct 2013) (r86499)
@@ -160,9 +160,11 @@
// http://www2.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf
// which is derived from Kahan's paper:
// http://http.cs.berkley.edu/~wkahan/ieee754status/ieee754.ps
- const unsigned int digits = (std::numeric_limits<float>::digits * 3010) / 10000;
- os << std::setprecision(digits);
- os << t;
+ // const unsigned int digits = (std::numeric_limits<T>::digits * 3010) / 10000;
+ // note: I've commented out the above because I didn't get good results. e.g.
+ // in one case I got a difference of 19 units.
+ const unsigned int digits = std::numeric_limits<T>::digits10 + 2;
+ os << std::setprecision(digits) << std::scientific << t;
}
template<class T>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk