summaryrefslogtreecommitdiff
path: root/boost/spirit/home/qi/numeric
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:24:46 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:25:39 +0900
commit4fadd968fa12130524c8380f33fcfe25d4de79e5 (patch)
treefd26a490cd15388d42fc6652b3c5c13012e7f93e /boost/spirit/home/qi/numeric
parentb5c87084afaef42b2d058f68091be31988a6a874 (diff)
downloadboost-4fadd968fa12130524c8380f33fcfe25d4de79e5.tar.gz
boost-4fadd968fa12130524c8380f33fcfe25d4de79e5.tar.bz2
boost-4fadd968fa12130524c8380f33fcfe25d4de79e5.zip
Imported Upstream version 1.65.0upstream/1.65.0
Change-Id: Icf8400b375482cb11bcf77440a6934ba360d6ba4 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/spirit/home/qi/numeric')
-rw-r--r--boost/spirit/home/qi/numeric/detail/numeric_utils.hpp10
-rw-r--r--boost/spirit/home/qi/numeric/detail/real_impl.hpp13
2 files changed, 17 insertions, 6 deletions
diff --git a/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp b/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
index ce9ad0f953..7f466ee65b 100644
--- a/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
+++ b/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
@@ -278,14 +278,20 @@ namespace boost { namespace spirit { namespace qi { namespace detail
#define SPIRIT_NUMERIC_INNER_LOOP(z, x, data) \
if (!check_max_digits<MaxDigits>::call(count + leading_zeros) \
|| it == last) \
+ { \
break; \
+ } \
ch = *it; \
if (!radix_check::is_valid(ch)) \
+ { \
break; \
+ } \
if (!extractor::call(ch, count, val)) \
{ \
if (IgnoreOverflowDigits) \
+ { \
first = it; \
+ } \
traits::assign_to(val, attr); \
return IgnoreOverflowDigits; \
} \
@@ -386,10 +392,14 @@ namespace boost { namespace spirit { namespace qi { namespace detail
///////////////////////////////////////////////////////////////////////////
#define SPIRIT_NUMERIC_INNER_LOOP(z, x, data) \
if (it == last) \
+ { \
break; \
+ } \
ch = *it; \
if (!radix_check::is_valid(ch)) \
+ { \
break; \
+ } \
if (!extractor::call(ch, count, val)) \
{ \
traits::assign_to(val, attr); \
diff --git a/boost/spirit/home/qi/numeric/detail/real_impl.hpp b/boost/spirit/home/qi/numeric/detail/real_impl.hpp
index 485df2727f..9aa5bb8bbd 100644
--- a/boost/spirit/home/qi/numeric/detail/real_impl.hpp
+++ b/boost/spirit/home/qi/numeric/detail/real_impl.hpp
@@ -32,7 +32,7 @@
namespace boost { namespace spirit { namespace traits
{
using spirit::traits::pow10;
-
+
namespace detail
{
template <typename T, typename AccT>
@@ -44,14 +44,14 @@ namespace boost { namespace spirit { namespace traits
n = T((acc_n / comp) * comp);
n += T(acc_n % comp);
}
-
+
template <typename T, typename AccT>
void compensate_roundoff(T& n, AccT acc_n, mpl::false_)
{
// no need to compensate
n = acc_n;
}
-
+
template <typename T, typename AccT>
void compensate_roundoff(T& n, AccT acc_n)
{
@@ -66,7 +66,7 @@ namespace boost { namespace spirit { namespace traits
if (exp >= 0)
{
int max_exp = std::numeric_limits<T>::max_exponent10;
-
+
// return false if exp exceeds the max_exp
// do this check only for primitive types!
if (is_floating_point<T>() && exp > max_exp)
@@ -80,7 +80,7 @@ namespace boost { namespace spirit { namespace traits
int min_exp = std::numeric_limits<T>::min_exponent10;
detail::compensate_roundoff(n, acc_n);
n /= pow10<T>(-min_exp);
-
+
// return false if (-exp + min_exp) exceeds the -min_exp
// do this check only for primitive types!
if (is_floating_point<T>() && (-exp + min_exp) > -min_exp)
@@ -284,7 +284,8 @@ namespace boost { namespace spirit { namespace qi { namespace detail
// If there is no number, disregard the exponent altogether.
// by resetting 'first' prior to the exponent prefix (e|E)
first = e_pos;
- n = static_cast<T>(acc_n);
+ // Scale the number by -frac_digits.
+ traits::scale(-frac_digits, n, acc_n);
}
}
else if (frac_digits)