|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66050 - trunk/boost/spirit/home/karma/numeric/detail
From: hartmut.kaiser_at_[hidden]
Date: 2010-10-17 16:37:27
Author: hkaiser
Date: 2010-10-17 16:37:19 EDT (Sun, 17 Oct 2010)
New Revision: 66050
URL: http://svn.boost.org/trac/boost/changeset/66050
Log:
Spirit: fixed #4742 (Karma produces not the supposed output for a real number generator in scientific mode)
Text files modified:
trunk/boost/spirit/home/karma/numeric/detail/real_utils.hpp | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
Modified: trunk/boost/spirit/home/karma/numeric/detail/real_utils.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/detail/real_utils.hpp (original)
+++ trunk/boost/spirit/home/karma/numeric/detail/real_utils.hpp 2010-10-17 16:37:19 EDT (Sun, 17 Oct 2010)
@@ -142,8 +142,13 @@
dim = log10(n);
if (dim > 0)
n /= spirit::detail::pow10<U>(detail::truncate_to_long::call(dim));
- else if (n < 1.)
- n *= spirit::detail::pow10<U>(detail::truncate_to_long::call(-dim) + 1);
+ else if (n < 1.) {
+ long exp = detail::truncate_to_long::call(-dim);
+ if (exp != -dim)
+ ++exp;
+ dim = -exp;
+ n *= spirit::detail::pow10<U>(exp);
+ }
}
// prepare numbers (sign, integer and fraction part)
@@ -206,7 +211,7 @@
if (r && 0 == (Policies::fmtflags::fixed & flags)) {
return p.template exponent<CharEncoding, Tag>(sink,
- detail::truncate_to_long::call(dim >= 0 ? dim : dim - 1));
+ detail::truncate_to_long::call(dim));
}
return r;
}
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