Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85312 - trunk/boost/multiprecision/cpp_int
From: john_at_[hidden]
Date: 2013-08-12 07:08:47


Author: johnmaddock
Date: 2013-08-12 07:08:47 EDT (Mon, 12 Aug 2013)
New Revision: 85312
URL: http://svn.boost.org/trac/boost/changeset/85312

Log:
Fix digits10 member for cpp_int's.

Text files modified:
   trunk/boost/multiprecision/cpp_int/limits.hpp | 2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

Modified: trunk/boost/multiprecision/cpp_int/limits.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_int/limits.hpp Mon Aug 12 04:05:32 2013 (r85311)
+++ trunk/boost/multiprecision/cpp_int/limits.hpp 2013-08-12 07:08:47 EDT (Mon, 12 Aug 2013) (r85312)
@@ -130,7 +130,7 @@
    }
    static number_type lowest() { return (min)(); }
    BOOST_STATIC_CONSTEXPR int digits = boost::multiprecision::backends::max_precision<backend_type>::value == UINT_MAX ? INT_MAX : boost::multiprecision::backends::max_precision<backend_type>::value;
- BOOST_STATIC_CONSTEXPR int digits10 = (INT_MAX / 1000) * 301L;
+ BOOST_STATIC_CONSTEXPR int digits10 = (digits > INT_MAX / 301) ? (digits / 1000) * 301L : (digits * 301) / 1000;
    BOOST_STATIC_CONSTEXPR int max_digits10 = digits10 + 2;
    BOOST_STATIC_CONSTEXPR bool is_signed = boost::multiprecision::is_signed_number<backend_type>::value;
    BOOST_STATIC_CONSTEXPR bool is_integer = true;


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