]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/multiprecision/cpp_dec_float.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / multiprecision / cpp_dec_float.hpp
index cae6f1c7670de26892bd39c4159ff6c68bdc359e..e643ad31471c44e7b95a81b016cef6101baed3bb 100644 (file)
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Copyright Christopher Kormanyos 2002 - 2013.
-// Copyright 2011 -2013 John Maddock. Distributed under the Boost
+// Copyright Christopher Kormanyos 2002 - 2021.
+// Copyright 2011 -2021 John Maddock. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
@@ -8,29 +8,37 @@
 // "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
 // in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
 //
-// Note that there are no "noexcept" specifications on the functions in this file: there are too many
-// calls to lexical_cast (and similar) to easily analyse the code for correctness. So until compilers
-// can detect noexcept misuse at compile time, the only realistic option is to simply not use it here.
+// There are some "noexcept" specifications on the functions in this file.
+// Unlike in pre-C++11 versions, compilers can now detect noexcept misuse
+// at compile time, allowing for simple use of it here.
 //
 
 #ifndef BOOST_MP_CPP_DEC_FLOAT_BACKEND_HPP
 #define BOOST_MP_CPP_DEC_FLOAT_BACKEND_HPP
 
-#include <boost/config.hpp>
-#include <boost/cstdint.hpp>
-#include <limits>
-#ifndef BOOST_NO_CXX11_HDR_ARRAY
+#include <cmath>
+#include <cstdint>
+#include <cstdlib>
+#include <algorithm>
 #include <array>
-#else
-#include <boost/array.hpp>
-#endif
-#include <boost/cstdint.hpp>
-#include <boost/functional/hash_fwd.hpp>
+#include <initializer_list>
+#include <iomanip>
+#include <string>
+#include <limits>
+#include <stdexcept>
+#include <boost/multiprecision/detail/standalone_config.hpp>
 #include <boost/multiprecision/number.hpp>
-#include <boost/multiprecision/detail/big_lanczos.hpp>
+#include <boost/multiprecision/detail/fpclassify.hpp>
 #include <boost/multiprecision/detail/dynamic_array.hpp>
+#include <boost/multiprecision/detail/hash.hpp>
+#include <boost/multiprecision/detail/float128_functions.hpp>
 #include <boost/multiprecision/detail/itos.hpp>
+#include <boost/multiprecision/detail/static_array.hpp>
+#include <boost/multiprecision/detail/tables.hpp>
+#include <boost/multiprecision/detail/no_exceptions_support.hpp>
+#include <boost/multiprecision/detail/assert.hpp>
 
+#ifdef BOOST_MP_MATH_AVAILABLE
 //
 // Headers required for Boost.Math integration:
 //
 //
 // Some includes we need from Boost.Math, since we rely on that library to provide these functions:
 //
-#include <boost/math/special_functions/asinh.hpp>
 #include <boost/math/special_functions/acosh.hpp>
+#include <boost/math/special_functions/asinh.hpp>
 #include <boost/math/special_functions/atanh.hpp>
 #include <boost/math/special_functions/cbrt.hpp>
 #include <boost/math/special_functions/expm1.hpp>
 #include <boost/math/special_functions/gamma.hpp>
+#endif
 
 #ifdef BOOST_MSVC
 #pragma warning(push)
@@ -54,13 +63,13 @@ namespace boost {
 namespace multiprecision {
 namespace backends {
 
-template <unsigned Digits10, class ExponentType = boost::int32_t, class Allocator = void>
+template <unsigned Digits10, class ExponentType = std::int32_t, class Allocator = void>
 class cpp_dec_float;
 
 } // namespace backends
 
 template <unsigned Digits10, class ExponentType, class Allocator>
-struct number_category<backends::cpp_dec_float<Digits10, ExponentType, Allocator> > : public mpl::int_<number_kind_floating_point>
+struct number_category<backends::cpp_dec_float<Digits10, ExponentType, Allocator> > : public std::integral_constant<int, number_kind_floating_point>
 {};
 
 namespace backends {
@@ -69,50 +78,59 @@ template <unsigned Digits10, class ExponentType, class Allocator>
 class cpp_dec_float
 {
  private:
-   static const boost::int32_t cpp_dec_float_digits10_setting = Digits10;
+   // Perform some static sanity checks.
+   static_assert(boost::multiprecision::detail::is_signed<ExponentType>::value,
+                 "ExponentType must be a signed built in integer type.");
 
-   // We need at least 16-bits in the exponent type to do anything sensible:
-   BOOST_STATIC_ASSERT_MSG(boost::is_signed<ExponentType>::value, "ExponentType must be a signed built in integer type.");
-   BOOST_STATIC_ASSERT_MSG(sizeof(ExponentType) > 1, "ExponentType is too small.");
+   static_assert(sizeof(ExponentType) > 1,
+                 "ExponentType is too small.");
+
+   static_assert(Digits10 < UINT32_C(0x80000000),
+                 "Digits10 exceeds the maximum.");
+
+   // Private class-local constants.
+   static constexpr std::int32_t  cpp_dec_float_digits10_limit_lo = INT32_C(9);
+   static constexpr std::int32_t  cpp_dec_float_digits10_limit_hi = static_cast<std::int32_t>((std::numeric_limits<std::int32_t>::max)() - 100);
+
+   static constexpr std::int32_t cpp_dec_float_elem_digits10      = INT32_C(8);
+   static constexpr std::int32_t cpp_dec_float_elem_mask          = INT32_C(100000000);
+
+   static constexpr std::int32_t cpp_dec_float_elems_for_kara     = static_cast<std::int32_t>(128 + 1);
 
  public:
-   typedef mpl::list<boost::long_long_type>  signed_types;
-   typedef mpl::list<boost::ulong_long_type> unsigned_types;
-   typedef mpl::list<double, long double>    float_types;
-   typedef ExponentType                      exponent_type;
-
-   static const boost::int32_t cpp_dec_float_radix             = 10L;
-   static const boost::int32_t cpp_dec_float_digits10_limit_lo = 9L;
-   static const boost::int32_t cpp_dec_float_digits10_limit_hi = boost::integer_traits<boost::int32_t>::const_max - 100;
-   static const boost::int32_t cpp_dec_float_digits10          = ((cpp_dec_float_digits10_setting < cpp_dec_float_digits10_limit_lo) ? cpp_dec_float_digits10_limit_lo : ((cpp_dec_float_digits10_setting > cpp_dec_float_digits10_limit_hi) ? cpp_dec_float_digits10_limit_hi : cpp_dec_float_digits10_setting));
-   static const ExponentType   cpp_dec_float_max_exp10         = (static_cast<ExponentType>(1) << (std::numeric_limits<ExponentType>::digits - 5));
-   static const ExponentType   cpp_dec_float_min_exp10         = -cpp_dec_float_max_exp10;
-   static const ExponentType   cpp_dec_float_max_exp           = cpp_dec_float_max_exp10;
-   static const ExponentType   cpp_dec_float_min_exp           = cpp_dec_float_min_exp10;
-
-   BOOST_STATIC_ASSERT((cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_max_exp10 == -cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_min_exp10));
+   using signed_types   = std::tuple<long long> ;
+   using unsigned_types = std::tuple<unsigned long long>;
+   using float_types    = std::tuple<double, long double>;
+   using exponent_type  = ExponentType;
 
- private:
-   static const boost::int32_t cpp_dec_float_elem_digits10 = 8L;
-   static const boost::int32_t cpp_dec_float_elem_mask     = 100000000L;
+   // Public class-local constants.
+   static constexpr std::int32_t  cpp_dec_float_radix             = INT32_C(10);
+   static constexpr std::int32_t  cpp_dec_float_digits10          = ((static_cast<std::int32_t>(Digits10) < cpp_dec_float_digits10_limit_lo) ? cpp_dec_float_digits10_limit_lo : ((static_cast<std::int32_t>(Digits10) > cpp_dec_float_digits10_limit_hi) ? cpp_dec_float_digits10_limit_hi : static_cast<std::int32_t>(Digits10)));
+   static constexpr exponent_type cpp_dec_float_max_exp10         = (static_cast<exponent_type>(1) << (std::numeric_limits<exponent_type>::digits - 5));
+   static constexpr exponent_type cpp_dec_float_min_exp10         = -cpp_dec_float_max_exp10;
+   static constexpr exponent_type cpp_dec_float_max_exp           = cpp_dec_float_max_exp10;
+   static constexpr exponent_type cpp_dec_float_min_exp           = cpp_dec_float_min_exp10;
+
+   static_assert(cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_max_exp10 == -cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_min_exp10, "Failed exponent range check");
 
-   BOOST_STATIC_ASSERT(0 == cpp_dec_float_max_exp10 % cpp_dec_float_elem_digits10);
+   static_assert(0 == cpp_dec_float_max_exp10 % cpp_dec_float_elem_digits10, "Failed digit sanity check");
 
+ private:
    // There are three guard limbs.
    // 1) The first limb has 'play' from 1...8 decimal digits.
    // 2) The last limb also has 'play' from 1...8 decimal digits.
-   // 3) One limb can get lost when justifying after multiply,
-   // as only half of the triangle is multiplied and a carry
-   // from below is missing.
-   static const boost::int32_t cpp_dec_float_elem_number_request = static_cast<boost::int32_t>((cpp_dec_float_digits10 / cpp_dec_float_elem_digits10) + (((cpp_dec_float_digits10 % cpp_dec_float_elem_digits10) != 0) ? 1 : 0));
-
-   // The number of elements needed (with a minimum of two) plus three added guard limbs.
-   static const boost::int32_t cpp_dec_float_elem_number = static_cast<boost::int32_t>(((cpp_dec_float_elem_number_request < 2L) ? 2L : cpp_dec_float_elem_number_request) + 3L);
+   // 3) One limb can get lost when justifying after multiply.
+   static constexpr std::int32_t cpp_dec_float_elem_number    = static_cast<std::int32_t>(((Digits10 / cpp_dec_float_elem_digits10) + (((Digits10 % cpp_dec_float_elem_digits10) != 0) ? 1 : 0)) + 3);
 
  public:
-   static const boost::int32_t cpp_dec_float_total_digits10 = static_cast<boost::int32_t>(cpp_dec_float_elem_number * cpp_dec_float_elem_digits10);
+   static constexpr std::int32_t cpp_dec_float_max_digits10   = static_cast<std::int32_t>(cpp_dec_float_elem_number * cpp_dec_float_elem_digits10);
 
  private:
+   using array_type =
+      typename std::conditional<std::is_void<Allocator>::value,
+                                detail::static_array <std::uint32_t, static_cast<std::uint32_t>(cpp_dec_float_elem_number)>,
+                                detail::dynamic_array<std::uint32_t, static_cast<std::uint32_t>(cpp_dec_float_elem_number), Allocator> >::type;
+
    typedef enum enum_fpclass_type
    {
       cpp_dec_float_finite,
@@ -120,83 +138,46 @@ class cpp_dec_float
       cpp_dec_float_NaN
    } fpclass_type;
 
-#ifndef BOOST_NO_CXX11_HDR_ARRAY
-   typedef typename mpl::if_<is_void<Allocator>,
-                             std::array<boost::uint32_t, cpp_dec_float_elem_number>,
-                             detail::dynamic_array<boost::uint32_t, cpp_dec_float_elem_number, Allocator> >::type array_type;
-#else
-   typedef typename mpl::if_<is_void<Allocator>,
-                             boost::array<boost::uint32_t, cpp_dec_float_elem_number>,
-                             detail::dynamic_array<boost::uint32_t, cpp_dec_float_elem_number, Allocator> >::type array_type;
-#endif
+   array_type    data;
+   exponent_type exp;
+   bool          neg;
+   fpclass_type  fpclass;
+   std::int32_t  prec_elem;
 
-   array_type     data;
-   ExponentType   exp;
-   bool           neg;
-   fpclass_type   fpclass;
-   boost::int32_t prec_elem;
-
-   //
-   // Special values constructor:
-   //
-   cpp_dec_float(fpclass_type c) : data(),
-                                   exp(static_cast<ExponentType>(0)),
-                                   neg(false),
-                                   fpclass(c),
-                                   prec_elem(cpp_dec_float_elem_number) {}
+   // Private constructor from the floating-point class type.
+   explicit cpp_dec_float(fpclass_type c) : data(),
+                                            exp(static_cast<exponent_type>(0)),
+                                            neg(false),
+                                            fpclass(c),
+                                            prec_elem(cpp_dec_float_elem_number) {}
 
-   //
-   // Static data initializer:
-   //
-   struct initializer
+   // Constructor from an initializer_list, an optional
+   // (value-aligned) exponent and a Boolean sign.
+   static cpp_dec_float from_lst(std::initializer_list<std::uint32_t> lst,
+                                 const exponent_type e = 0,
+                                 const bool n = false)
    {
-      initializer()
-      {
-         cpp_dec_float<Digits10, ExponentType, Allocator>::nan();
-         cpp_dec_float<Digits10, ExponentType, Allocator>::inf();
-         (cpp_dec_float<Digits10, ExponentType, Allocator>::min)();
-         (cpp_dec_float<Digits10, ExponentType, Allocator>::max)();
-         cpp_dec_float<Digits10, ExponentType, Allocator>::zero();
-         cpp_dec_float<Digits10, ExponentType, Allocator>::one();
-         cpp_dec_float<Digits10, ExponentType, Allocator>::two();
-         cpp_dec_float<Digits10, ExponentType, Allocator>::half();
-         cpp_dec_float<Digits10, ExponentType, Allocator>::double_min();
-         cpp_dec_float<Digits10, ExponentType, Allocator>::double_max();
-         //cpp_dec_float<Digits10, ExponentType, Allocator>::long_double_max();
-         //cpp_dec_float<Digits10, ExponentType, Allocator>::long_double_min();
-         cpp_dec_float<Digits10, ExponentType, Allocator>::long_long_max();
-         cpp_dec_float<Digits10, ExponentType, Allocator>::long_long_min();
-         cpp_dec_float<Digits10, ExponentType, Allocator>::ulong_long_max();
-         cpp_dec_float<Digits10, ExponentType, Allocator>::eps();
-         cpp_dec_float<Digits10, ExponentType, Allocator>::pow2(0);
-      }
-      void do_nothing() {}
-   };
+      cpp_dec_float a;
 
-   static initializer init;
+      a.data      = array_type(lst);
+      a.exp       = e;
+      a.neg       = n;
+      a.fpclass   = cpp_dec_float_finite;
+      a.prec_elem = cpp_dec_float_elem_number;
 
-   struct long_double_initializer
-   {
-      long_double_initializer()
-      {
-         cpp_dec_float<Digits10, ExponentType, Allocator>::long_double_max();
-         cpp_dec_float<Digits10, ExponentType, Allocator>::long_double_min();
-      }
-      void do_nothing() {}
-   };
-
-   static long_double_initializer linit;
+      return a;
+   }
 
  public:
-   // Constructors
-   cpp_dec_float() BOOST_MP_NOEXCEPT_IF(noexcept(array_type())) : data(),
-                                                                  exp(static_cast<ExponentType>(0)),
-                                                                  neg(false),
-                                                                  fpclass(cpp_dec_float_finite),
-                                                                  prec_elem(cpp_dec_float_elem_number) {}
+   // Public Constructors
+   cpp_dec_float() noexcept(noexcept(array_type())) : data(),
+                                                      exp(static_cast<exponent_type>(0)),
+                                                      neg(false),
+                                                      fpclass(cpp_dec_float_finite),
+                                                      prec_elem(cpp_dec_float_elem_number) {}
 
    cpp_dec_float(const char* s) : data(),
-                                  exp(static_cast<ExponentType>(0)),
+                                  exp(static_cast<exponent_type>(0)),
                                   neg(false),
                                   fpclass(cpp_dec_float_finite),
                                   prec_elem(cpp_dec_float_elem_number)
@@ -205,21 +186,27 @@ class cpp_dec_float
    }
 
    template <class I>
-   cpp_dec_float(I i, typename enable_if<is_unsigned<I> >::type* = 0) : data(),
-                                                                        exp(static_cast<ExponentType>(0)),
-                                                                        neg(false),
-                                                                        fpclass(cpp_dec_float_finite),
-                                                                        prec_elem(cpp_dec_float_elem_number)
+   cpp_dec_float(I i,
+                 typename std::enable_if<boost::multiprecision::detail::is_unsigned<I>::value && (sizeof(I) <= sizeof(long long))>::type* = nullptr)
+      : data(),
+        exp(static_cast<exponent_type>(0)),
+        neg(false),
+        fpclass(cpp_dec_float_finite),
+        prec_elem(cpp_dec_float_elem_number)
    {
       from_unsigned_long_long(i);
    }
 
    template <class I>
-   cpp_dec_float(I i, typename enable_if<is_signed<I> >::type* = 0) : data(),
-                                                                      exp(static_cast<ExponentType>(0)),
-                                                                      neg(false),
-                                                                      fpclass(cpp_dec_float_finite),
-                                                                      prec_elem(cpp_dec_float_elem_number)
+   cpp_dec_float(I i,
+                 typename std::enable_if<(   boost::multiprecision::detail::is_signed<I>::value
+                                          && boost::multiprecision::detail::is_integral<I>::value
+                                          && (sizeof(I) <= sizeof(long long)))>::type* = nullptr)
+      : data(),
+        exp(static_cast<exponent_type>(0)),
+        neg(false),
+        fpclass(cpp_dec_float_finite),
+        prec_elem(cpp_dec_float_elem_number)
    {
       if (i < 0)
       {
@@ -227,185 +214,115 @@ class cpp_dec_float
          negate();
       }
       else
-         from_unsigned_long_long(i);
+         from_unsigned_long_long(static_cast<unsigned long long>(i));
    }
 
-   cpp_dec_float(const cpp_dec_float& f) BOOST_MP_NOEXCEPT_IF(noexcept(array_type(std::declval<const array_type&>()))) : data(f.data),
-                                                                                                                         exp(f.exp),
-                                                                                                                         neg(f.neg),
-                                                                                                                         fpclass(f.fpclass),
-                                                                                                                         prec_elem(f.prec_elem) {}
+   cpp_dec_float(const cpp_dec_float& f) noexcept(noexcept(array_type(std::declval<const array_type&>())))
+      : data(f.data),
+        exp(f.exp),
+        neg(f.neg),
+        fpclass(f.fpclass),
+        prec_elem(f.prec_elem) {}
 
    template <unsigned D, class ET, class A>
-   cpp_dec_float(const cpp_dec_float<D, ET, A>& f, typename enable_if_c<D <= Digits10>::type* = 0) : data(),
-                                                                                                     exp(f.exp),
-                                                                                                     neg(f.neg),
-                                                                                                     fpclass(static_cast<fpclass_type>(static_cast<int>(f.fpclass))),
-                                                                                                     prec_elem(cpp_dec_float_elem_number)
+   cpp_dec_float(const cpp_dec_float<D, ET, A>& f, typename std::enable_if<D <= Digits10>::type* = nullptr)
+      : data(),
+        exp(f.exp),
+        neg(f.neg),
+        fpclass(static_cast<fpclass_type>(static_cast<int>(f.fpclass))),
+        prec_elem(cpp_dec_float_elem_number)
    {
       std::copy(f.data.begin(), f.data.begin() + f.prec_elem, data.begin());
    }
    template <unsigned D, class ET, class A>
-   explicit cpp_dec_float(const cpp_dec_float<D, ET, A>& f, typename disable_if_c<D <= Digits10>::type* = 0) : data(),
-                                                                                                               exp(f.exp),
-                                                                                                               neg(f.neg),
-                                                                                                               fpclass(static_cast<fpclass_type>(static_cast<int>(f.fpclass))),
-                                                                                                               prec_elem(cpp_dec_float_elem_number)
+   explicit cpp_dec_float(const cpp_dec_float<D, ET, A>& f, typename std::enable_if< !(D <= Digits10)>::type* = nullptr)
+      : data(),
+        exp(f.exp),
+        neg(f.neg),
+        fpclass(static_cast<fpclass_type>(static_cast<int>(f.fpclass))),
+        prec_elem(cpp_dec_float_elem_number)
    {
       // TODO: this doesn't round!
       std::copy(f.data.begin(), f.data.begin() + prec_elem, data.begin());
    }
 
    template <class F>
-   cpp_dec_float(const F val, typename enable_if_c<is_floating_point<F>::value
-#ifdef BOOST_HAS_FLOAT128
-                                                   && !boost::is_same<F, __float128>::value
-#endif
-                                                   >::type* = 0) : data(),
-                                                                   exp(static_cast<ExponentType>(0)),
-                                                                   neg(false),
-                                                                   fpclass(cpp_dec_float_finite),
-                                                                   prec_elem(cpp_dec_float_elem_number)
+   cpp_dec_float(const F val, typename std::enable_if<std::is_floating_point<F>::value
+                                                   >::type* = nullptr) : data(),
+                                                                         exp(static_cast<exponent_type>(0)),
+                                                                         neg(false),
+                                                                         fpclass(cpp_dec_float_finite),
+                                                                         prec_elem(cpp_dec_float_elem_number)
    {
       *this = val;
    }
 
-   cpp_dec_float(const double mantissa, const ExponentType exponent);
+   cpp_dec_float(const double mantissa, const exponent_type exponent);
 
    std::size_t hash() const
    {
       std::size_t result = 0;
       for (int i = 0; i < prec_elem; ++i)
-         boost::hash_combine(result, data[i]);
-      boost::hash_combine(result, exp);
-      boost::hash_combine(result, neg);
-      boost::hash_combine(result, fpclass);
+         boost::multiprecision::detail::hash_combine(result, data[i]);
+      boost::multiprecision::detail::hash_combine(result, exp, neg, static_cast<std::size_t>(fpclass));
       return result;
    }
 
    // Specific special values.
-   static const cpp_dec_float& nan()
-   {
-      static const cpp_dec_float val(cpp_dec_float_NaN);
-      init.do_nothing();
-      return val;
-   }
-
-   static const cpp_dec_float& inf()
-   {
-      static const cpp_dec_float val(cpp_dec_float_inf);
-      init.do_nothing();
-      return val;
-   }
-
-   static const cpp_dec_float&(max)()
-   {
-      init.do_nothing();
-      static cpp_dec_float val_max = std::string("1.0e" + boost::multiprecision::detail::itos(cpp_dec_float_max_exp10)).c_str();
-      return val_max;
-   }
-
-   static const cpp_dec_float&(min)()
-   {
-      init.do_nothing();
-      static cpp_dec_float val_min = std::string("1.0e" + boost::multiprecision::detail::itos(cpp_dec_float_min_exp10)).c_str();
-      return val_min;
-   }
-
-   static const cpp_dec_float& zero()
-   {
-      init.do_nothing();
-      static cpp_dec_float val(static_cast<boost::ulong_long_type>(0u));
-      return val;
-   }
-
-   static const cpp_dec_float& one()
-   {
-      init.do_nothing();
-      static cpp_dec_float val(static_cast<boost::ulong_long_type>(1u));
-      return val;
-   }
-
-   static const cpp_dec_float& two()
-   {
-      init.do_nothing();
-      static cpp_dec_float val(static_cast<boost::ulong_long_type>(2u));
-      return val;
-   }
-
-   static const cpp_dec_float& half()
-   {
-      init.do_nothing();
-      static cpp_dec_float val(0.5L);
-      return val;
-   }
-
-   static const cpp_dec_float& double_min()
-   {
-      init.do_nothing();
-      static cpp_dec_float val((std::numeric_limits<double>::min)());
-      return val;
-   }
-
-   static const cpp_dec_float& double_max()
-   {
-      init.do_nothing();
-      static cpp_dec_float val((std::numeric_limits<double>::max)());
-      return val;
-   }
+   static const cpp_dec_float&  nan () { static const cpp_dec_float val(cpp_dec_float_NaN); return val; }
+   static const cpp_dec_float&  inf () { static const cpp_dec_float val(cpp_dec_float_inf); return val; }
+   static const cpp_dec_float& (max)() { static const cpp_dec_float val(from_lst({ std::uint32_t(1u) }, cpp_dec_float_max_exp10)); return val; }
+   static const cpp_dec_float& (min)() { static const cpp_dec_float val(from_lst({ std::uint32_t(1u) }, cpp_dec_float_min_exp10)); return val; }
+   static const cpp_dec_float&  zero() { static const cpp_dec_float val(from_lst({ std::uint32_t(0u) })); return val; }
+   static const cpp_dec_float&  one () { static const cpp_dec_float val(from_lst({ std::uint32_t(1u) })); return val; }
+   static const cpp_dec_float&  two () { static const cpp_dec_float val(from_lst({ std::uint32_t(2u) })); return val; }
+   static const cpp_dec_float&  half() { static const cpp_dec_float val(from_lst({ std::uint32_t(cpp_dec_float_elem_mask / 2)}, -8)); return val; }
+
+   static const cpp_dec_float& double_min() { static const cpp_dec_float val((std::numeric_limits<double>::min)()); return val; }
+   static const cpp_dec_float& double_max() { static const cpp_dec_float val((std::numeric_limits<double>::max)()); return val; }
 
    static const cpp_dec_float& long_double_min()
    {
-      linit.do_nothing();
 #ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
-      static cpp_dec_float val(static_cast<long double>((std::numeric_limits<double>::min)()));
+      static const cpp_dec_float val(static_cast<long double>((std::numeric_limits<double>::min)()));
 #else
-      static cpp_dec_float val((std::numeric_limits<long double>::min)());
+      static const cpp_dec_float val((std::numeric_limits<long double>::min)());
 #endif
       return val;
    }
 
    static const cpp_dec_float& long_double_max()
    {
-       linit.do_nothing();
 #ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
-      static cpp_dec_float val(static_cast<long double>((std::numeric_limits<double>::max)()));
+      static const cpp_dec_float val(static_cast<long double>((std::numeric_limits<double>::max)()));
 #else
-      static cpp_dec_float val((std::numeric_limits<long double>::max)());
+      static const cpp_dec_float val((std::numeric_limits<long double>::max)());
 #endif
       return val;
    }
 
-   static const cpp_dec_float& long_long_max()
-   {
-      init.do_nothing();
-      static cpp_dec_float val((std::numeric_limits<boost::long_long_type>::max)());
-      return val;
-   }
-
-   static const cpp_dec_float& long_long_min()
-   {
-      init.do_nothing();
-      static cpp_dec_float val((std::numeric_limits<boost::long_long_type>::min)());
-      return val;
-   }
-
-   static const cpp_dec_float& ulong_long_max()
-   {
-      init.do_nothing();
-      static cpp_dec_float val((std::numeric_limits<boost::ulong_long_type>::max)());
-      return val;
-   }
+   static const cpp_dec_float& long_long_max () { static const cpp_dec_float val((std::numeric_limits<long long>::max)()); return val; }
+   static const cpp_dec_float& long_long_min () { static const cpp_dec_float val((std::numeric_limits<long long>::min)()); return val; }
+   static const cpp_dec_float& ulong_long_max() { static const cpp_dec_float val((std::numeric_limits<unsigned long long>::max)()); return val; }
 
    static const cpp_dec_float& eps()
    {
-      init.do_nothing();
-      static cpp_dec_float val(1.0, 1 - static_cast<int>(cpp_dec_float_digits10));
+      static const cpp_dec_float val
+      (
+        from_lst
+        (
+          {
+            (std::uint32_t) detail::pow10_maker((std::uint32_t) ((std::int32_t) (INT32_C(1) + (std::int32_t) (((cpp_dec_float_digits10 / cpp_dec_float_elem_digits10) + ((cpp_dec_float_digits10 % cpp_dec_float_elem_digits10) != 0 ? 1 : 0)) * cpp_dec_float_elem_digits10)) - cpp_dec_float_digits10))
+          },
+          -(exponent_type) (((cpp_dec_float_digits10 / cpp_dec_float_elem_digits10) + ((cpp_dec_float_digits10 % cpp_dec_float_elem_digits10) != 0 ? 1 : 0)) * cpp_dec_float_elem_digits10)
+        )
+      );
+
       return val;
    }
 
    // Basic operations.
-   cpp_dec_float& operator=(const cpp_dec_float& v) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval<array_type&>() = std::declval<const array_type&>()))
+   cpp_dec_float& operator=(const cpp_dec_float& v) noexcept(noexcept(std::declval<array_type&>() = std::declval<const array_type&>()))
    {
       data      = v.data;
       exp       = v.exp;
@@ -428,11 +345,11 @@ class cpp_dec_float
       return *this;
    }
 
-   cpp_dec_float& operator=(boost::long_long_type v)
+   cpp_dec_float& operator=(long long v)
    {
       if (v < 0)
       {
-         from_unsigned_long_long(1u - boost::ulong_long_type(v + 1)); // Avoid undefined behaviour in negation of minimum value for long long
+         from_unsigned_long_long(boost::multiprecision::detail::unsigned_abs(v));
          negate();
       }
       else
@@ -440,14 +357,43 @@ class cpp_dec_float
       return *this;
    }
 
-   cpp_dec_float& operator=(boost::ulong_long_type v)
+   cpp_dec_float& operator=(unsigned long long v)
    {
       from_unsigned_long_long(v);
       return *this;
    }
+#ifdef BOOST_HAS_INT128
+   cpp_dec_float& operator=(int128_type v)
+   {
+      *this = boost::multiprecision::detail::unsigned_abs(v);
+      if (v < 0)
+         negate();
+      return *this;
+   }
+
+   cpp_dec_float& operator=(uint128_type v)
+   {
+      using default_ops::eval_add;
+      using default_ops::eval_multiply;
+      static constexpr unsigned          bit_shift = sizeof(unsigned long long) * CHAR_BIT;
+      static constexpr uint128_type mask      = (static_cast<uint128_type>(1u) << bit_shift) - 1;
+      unsigned                           shift     = bit_shift;
+      *this                                        = static_cast<unsigned long long>(v & mask);
+      v >>= bit_shift;
+      while (v)
+      {
+         cpp_dec_float t(static_cast<unsigned long long>(v & mask));
+         eval_multiply(t, cpp_dec_float::pow2(bit_shift));
+         eval_add(*this, t);
+         v >>= bit_shift;
+         shift += bit_shift;
+      }
+      return *this;
+   }
+#endif
 
    template <class Float>
-   typename boost::enable_if_c<boost::is_floating_point<Float>::value, cpp_dec_float&>::type operator=(Float v);
+   typename std::enable_if<std::is_floating_point<Float>::value, cpp_dec_float&>::type operator=(Float v);
 
    cpp_dec_float& operator=(const char* v)
    {
@@ -460,22 +406,22 @@ class cpp_dec_float
    cpp_dec_float& operator*=(const cpp_dec_float& v);
    cpp_dec_float& operator/=(const cpp_dec_float& v);
 
-   cpp_dec_float& add_unsigned_long_long(const boost::ulong_long_type n)
+   cpp_dec_float& add_unsigned_long_long(const unsigned long long n)
    {
       cpp_dec_float t;
       t.from_unsigned_long_long(n);
       return *this += t;
    }
 
-   cpp_dec_float& sub_unsigned_long_long(const boost::ulong_long_type n)
+   cpp_dec_float& sub_unsigned_long_long(const unsigned long long n)
    {
       cpp_dec_float t;
       t.from_unsigned_long_long(n);
       return *this -= t;
    }
 
-   cpp_dec_float& mul_unsigned_long_long(const boost::ulong_long_type n);
-   cpp_dec_float& div_unsigned_long_long(const boost::ulong_long_type n);
+   cpp_dec_float& mul_unsigned_long_long(const unsigned long long n);
+   cpp_dec_float& div_unsigned_long_long(const unsigned long long n);
 
    // Elementary primitives.
    cpp_dec_float& calculate_inv();
@@ -512,7 +458,7 @@ class cpp_dec_float
       return *this -= one();
    }
 
-   std::string str(boost::intmax_t digits, std::ios_base::fmtflags f) const;
+   std::string str(std::intmax_t digits, std::ios_base::fmtflags f) const;
 
    int compare(const cpp_dec_float& v) const;
 
@@ -535,32 +481,31 @@ class cpp_dec_float
 
    double                 extract_double() const;
    long double            extract_long_double() const;
-   boost::long_long_type  extract_signed_long_long() const;
-   boost::ulong_long_type extract_unsigned_long_long() const;
-   void                   extract_parts(double& mantissa, ExponentType& exponent) const;
+   long long  extract_signed_long_long() const;
+   unsigned long long extract_unsigned_long_long() const;
+#ifdef BOOST_HAS_INT128
+   int128_type  extract_signed_int128() const;
+   uint128_type extract_unsigned_int128() const;
+#endif
+   void                   extract_parts(double& mantissa, exponent_type& exponent) const;
    cpp_dec_float          extract_integer_part() const;
 
-   void precision(const boost::int32_t prec_digits)
+   void precision(const std::int32_t prec_digits)
    {
-      if (prec_digits >= cpp_dec_float_total_digits10)
-      {
-         prec_elem = cpp_dec_float_elem_number;
-      }
-      else
-      {
-         const boost::int32_t elems = static_cast<boost::int32_t>(static_cast<boost::int32_t>((prec_digits + (cpp_dec_float_elem_digits10 / 2)) / cpp_dec_float_elem_digits10) + static_cast<boost::int32_t>(((prec_digits % cpp_dec_float_elem_digits10) != 0) ? 1 : 0));
+      const std::int32_t elems =
+        static_cast<std::int32_t>(    static_cast<std::int32_t>(prec_digits / cpp_dec_float_elem_digits10)
+                                  +                          (((prec_digits % cpp_dec_float_elem_digits10) != 0) ? 1 : 0));
 
-         prec_elem = (std::min)(cpp_dec_float_elem_number, (std::max)(elems, static_cast<boost::int32_t>(2)));
-      }
+      prec_elem = (std::min)(cpp_dec_float_elem_number, (std::max)(elems, static_cast<std::int32_t>(2)));
    }
-   static cpp_dec_float pow2(boost::long_long_type i);
-   ExponentType         order() const
+   static cpp_dec_float pow2(long long i);
+   exponent_type order() const
    {
-      const bool bo_order_is_zero = ((!(isfinite)()) || (data[0] == static_cast<boost::uint32_t>(0u)));
+      const bool bo_order_is_zero = ((!(isfinite)()) || (data[0] == static_cast<std::uint32_t>(0u)));
       //
       // Binary search to find the order of the leading term:
       //
-      ExponentType prefix = 0;
+      exponent_type prefix = 0;
 
       if (data[0] >= 100000UL)
       {
@@ -602,9 +547,10 @@ class cpp_dec_float
          }
       }
 
-      return (bo_order_is_zero ? static_cast<ExponentType>(0) : static_cast<ExponentType>(exp + prefix));
+      return (bo_order_is_zero ? static_cast<exponent_type>(0) : static_cast<exponent_type>(exp + prefix));
    }
 
+   #ifndef BOOST_MP_STANDALONE
    template <class Archive>
    void serialize(Archive& ar, const unsigned int /*version*/)
    {
@@ -615,19 +561,167 @@ class cpp_dec_float
       ar& boost::make_nvp("class-type", fpclass);
       ar& boost::make_nvp("precision", prec_elem);
    }
+   #endif
 
  private:
-   static bool data_elem_is_non_zero_predicate(const boost::uint32_t& d) { return (d != static_cast<boost::uint32_t>(0u)); }
-   static bool data_elem_is_non_nine_predicate(const boost::uint32_t& d) { return (d != static_cast<boost::uint32_t>(cpp_dec_float::cpp_dec_float_elem_mask - 1)); }
+   static bool data_elem_is_non_zero_predicate(const std::uint32_t& d) { return (d != static_cast<std::uint32_t>(0u)); }
+   static bool data_elem_is_non_nine_predicate(const std::uint32_t& d) { return (d != static_cast<std::uint32_t>(cpp_dec_float::cpp_dec_float_elem_mask - 1)); }
    static bool char_is_nonzero_predicate(const char& c) { return (c != static_cast<char>('0')); }
 
-   void from_unsigned_long_long(const boost::ulong_long_type u);
+   void from_unsigned_long_long(const unsigned long long u);
+
+   template <typename InputIteratorTypeLeft,
+             typename InputIteratorTypeRight>
+   static int compare_ranges(InputIteratorTypeLeft  a,
+                             InputIteratorTypeRight b,
+                             const std::uint32_t    count = cpp_dec_float_elem_number);
+
+   static std::uint32_t eval_add_n(      std::uint32_t* r,
+                                   const std::uint32_t* u,
+                                   const std::uint32_t* v,
+                                   const std::int32_t   count);
+
+   static std::uint32_t eval_subtract_n(      std::uint32_t* r,
+                                        const std::uint32_t* u,
+                                        const std::uint32_t* v,
+                                        const std::int32_t   count);
+
+   static void eval_multiply_n_by_n_to_2n(      std::uint32_t* r,
+                                          const std::uint32_t* a,
+                                          const std::uint32_t* b,
+                                          const std::uint32_t  count);
+
+   static std::uint32_t mul_loop_n(std::uint32_t* const u, std::uint32_t n, const std::int32_t p);
+   static std::uint32_t div_loop_n(std::uint32_t* const u, std::uint32_t n, const std::int32_t p);
 
-   int cmp_data(const array_type& vd) const;
+   static void eval_multiply_kara_propagate_carry (std::uint32_t* t, const std::uint32_t n, const std::uint32_t carry);
+   static void eval_multiply_kara_propagate_borrow(std::uint32_t* t, const std::uint32_t n, const bool has_borrow);
+   static void eval_multiply_kara_n_by_n_to_2n    (      std::uint32_t* r,
+                                                   const std::uint32_t* a,
+                                                   const std::uint32_t* b,
+                                                   const std::uint32_t  n,
+                                                         std::uint32_t* t);
 
-   static boost::uint32_t mul_loop_uv(boost::uint32_t* const u, const boost::uint32_t* const v, const boost::int32_t p);
-   static boost::uint32_t mul_loop_n(boost::uint32_t* const u, boost::uint32_t n, const boost::int32_t p);
-   static boost::uint32_t div_loop_n(boost::uint32_t* const u, boost::uint32_t n, const boost::int32_t p);
+   template<unsigned D>
+   void eval_mul_dispatch_multiplication_method(
+      const cpp_dec_float<D, ExponentType, Allocator>& v,
+      const std::int32_t prec_elems_for_multiply,
+      const typename std::enable_if<   (D == Digits10)
+                                    && (cpp_dec_float<D, ExponentType, Allocator>::cpp_dec_float_elem_number < cpp_dec_float_elems_for_kara)>::type* = nullptr)
+   {
+      // Use school multiplication.
+
+      using array_for_mul_result_type =
+         typename std::conditional<std::is_void<Allocator>::value,
+                                   detail::static_array <std::uint32_t, std::uint32_t(cpp_dec_float_elem_number * 2)>,
+                                   detail::dynamic_array<std::uint32_t, std::uint32_t(cpp_dec_float_elem_number * 2), Allocator> >::type;
+
+      array_for_mul_result_type result;
+
+      eval_multiply_n_by_n_to_2n(result.data(), data.data(), v.data.data(), static_cast<std::uint32_t>(prec_elems_for_multiply));
+
+      // Handle a potential carry.
+      if(result[0U] != static_cast<std::uint32_t>(0U))
+      {
+         exp += static_cast<exponent_type>(cpp_dec_float_elem_digits10);
+
+         // Shift the result of the multiplication one element to the right.
+         std::copy(result.cbegin(),
+                   result.cbegin() + static_cast<std::ptrdiff_t>(prec_elems_for_multiply),
+                   data.begin());
+      }
+      else
+      {
+         std::copy(result.cbegin() + 1,
+                   result.cbegin() + (std::min)(static_cast<std::int32_t>(prec_elems_for_multiply + 1), cpp_dec_float_elem_number),
+                   data.begin());
+      }
+   }
+
+   template<unsigned D>
+   void eval_mul_dispatch_multiplication_method(
+      const cpp_dec_float<D, ExponentType, Allocator>& v,
+      const std::int32_t prec_elems_for_multiply,
+      const typename std::enable_if<    (D == Digits10)
+                                    && !(cpp_dec_float<D, ExponentType, Allocator>::cpp_dec_float_elem_number < cpp_dec_float_elems_for_kara)>::type* = nullptr)
+   {
+      if(prec_elems_for_multiply < cpp_dec_float_elems_for_kara)
+      {
+         // Use school multiplication.
+
+         using array_for_mul_result_type =
+            typename std::conditional<std::is_void<Allocator>::value,
+                                      detail::static_array <std::uint32_t, std::uint32_t(cpp_dec_float_elem_number * 2)>,
+                                      detail::dynamic_array<std::uint32_t, std::uint32_t(cpp_dec_float_elem_number * 2), Allocator> >::type;
+
+         array_for_mul_result_type result;
+
+         eval_multiply_n_by_n_to_2n(result.data(), data.data(), v.data.data(), prec_elems_for_multiply);
+
+         // Handle a potential carry.
+         if(result[0U] != static_cast<std::uint32_t>(0U))
+         {
+            exp += static_cast<exponent_type>(cpp_dec_float_elem_digits10);
+         
+            // Shift the result of the multiplication one element to the right.
+            std::copy(result.cbegin(),
+                      result.cbegin() + static_cast<std::ptrdiff_t>(prec_elems_for_multiply),
+                      data.begin());
+         }
+         else
+         {
+            std::copy(result.cbegin() + 1,
+                      result.cbegin() + (std::min)(static_cast<std::int32_t>(prec_elems_for_multiply + 1), cpp_dec_float_elem_number),
+                      data.begin());
+         }
+      }
+      else
+      {
+         // Use Karatsuba multiplication.
+
+         using array_for_kara_tmp_type =
+            typename std::conditional<std::is_void<Allocator>::value,
+                                      detail::static_array <std::uint32_t, detail::a029750::a029750_as_constexpr(static_cast<std::uint32_t>(cpp_dec_float_elem_number)) * 8U>,
+                                      detail::dynamic_array<std::uint32_t, detail::a029750::a029750_as_constexpr(static_cast<std::uint32_t>(cpp_dec_float_elem_number)) * 8U, Allocator> >::type;
+
+         // Sloanes's A029747: Numbers of the form 2^k times 1, 3 or 5.
+         const std::uint32_t kara_elems_for_multiply =
+            detail::a029750::a029750_as_runtime_value(static_cast<std::uint32_t>(prec_elems_for_multiply));
+
+         array_for_kara_tmp_type my_kara_mul_pool;
+
+         std::uint32_t* result  = my_kara_mul_pool.data() + (kara_elems_for_multiply * 0U);
+         std::uint32_t* t       = my_kara_mul_pool.data() + (kara_elems_for_multiply * 2U);
+         std::uint32_t* u_local = my_kara_mul_pool.data() + (kara_elems_for_multiply * 6U);
+         std::uint32_t* v_local = my_kara_mul_pool.data() + (kara_elems_for_multiply * 7U);
+
+         std::copy(  data.cbegin(),   data.cbegin() + prec_elems_for_multiply, u_local);
+         std::copy(v.data.cbegin(), v.data.cbegin() + prec_elems_for_multiply, v_local);
+
+         eval_multiply_kara_n_by_n_to_2n(result,
+                                         u_local,
+                                         v_local,
+                                         kara_elems_for_multiply,
+                                         t);
+
+         // Handle a potential carry.
+         if(result[0U] != static_cast<std::uint32_t>(0U))
+         {
+            exp += static_cast<exponent_type>(cpp_dec_float_elem_digits10);
+
+            // Shift the result of the multiplication one element to the right.
+            std::copy(result,
+                      result + static_cast<std::ptrdiff_t>(prec_elems_for_multiply),
+                      data.begin());
+         }
+         else
+         {
+            std::copy(result + 1,
+                      result + (std::min)(static_cast<std::int32_t>(prec_elems_for_multiply + 1), cpp_dec_float_elem_number),
+                      data.begin());
+         }
+      }
+   }
 
    bool rd_string(const char* const s);
 
@@ -636,20 +730,13 @@ class cpp_dec_float
 };
 
 template <unsigned Digits10, class ExponentType, class Allocator>
-typename cpp_dec_float<Digits10, ExponentType, Allocator>::initializer cpp_dec_float<Digits10, ExponentType, Allocator>::init;
-template <unsigned Digits10, class ExponentType, class Allocator>
-typename cpp_dec_float<Digits10, ExponentType, Allocator>::long_double_initializer cpp_dec_float<Digits10, ExponentType, Allocator>::linit;
-
-template <unsigned Digits10, class ExponentType, class Allocator>
-const boost::int32_t cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_radix;
+const std::int32_t cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_radix;
 template <unsigned Digits10, class ExponentType, class Allocator>
-const boost::int32_t cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_digits10_setting;
+const std::int32_t cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_digits10_limit_lo;
 template <unsigned Digits10, class ExponentType, class Allocator>
-const boost::int32_t cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_digits10_limit_lo;
+const std::int32_t cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_digits10_limit_hi;
 template <unsigned Digits10, class ExponentType, class Allocator>
-const boost::int32_t cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_digits10_limit_hi;
-template <unsigned Digits10, class ExponentType, class Allocator>
-const boost::int32_t cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_digits10;
+const std::int32_t cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_digits10;
 template <unsigned Digits10, class ExponentType, class Allocator>
 const ExponentType cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_max_exp;
 template <unsigned Digits10, class ExponentType, class Allocator>
@@ -659,13 +746,11 @@ const ExponentType cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_flo
 template <unsigned Digits10, class ExponentType, class Allocator>
 const ExponentType cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_min_exp10;
 template <unsigned Digits10, class ExponentType, class Allocator>
-const boost::int32_t cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_elem_digits10;
-template <unsigned Digits10, class ExponentType, class Allocator>
-const boost::int32_t cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_elem_number_request;
+const std::int32_t cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_elem_digits10;
 template <unsigned Digits10, class ExponentType, class Allocator>
-const boost::int32_t cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_elem_number;
+const std::int32_t cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_elem_number;
 template <unsigned Digits10, class ExponentType, class Allocator>
-const boost::int32_t cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_elem_mask;
+const std::int32_t cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_elem_mask;
 
 template <unsigned Digits10, class ExponentType, class Allocator>
 cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, ExponentType, Allocator>::operator+=(const cpp_dec_float<Digits10, ExponentType, Allocator>& v)
@@ -696,9 +781,10 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
    }
 
    // Get the offset for the add/sub operation.
-   static const ExponentType max_delta_exp = static_cast<ExponentType>((cpp_dec_float_elem_number - 1) * cpp_dec_float_elem_digits10);
+   constexpr exponent_type max_delta_exp =
+     static_cast<exponent_type>((cpp_dec_float_elem_number - 1) * cpp_dec_float_elem_digits10);
 
-   const ExponentType ofs_exp = static_cast<ExponentType>(exp - v.exp);
+   const exponent_type ofs_exp = static_cast<exponent_type>(exp - v.exp);
 
    // Check if the operation is out of range, requiring special handling.
    if (v.iszero() || (ofs_exp > max_delta_exp))
@@ -714,11 +800,11 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
 
    // Do the add/sub operation.
 
-   typename array_type::iterator       p_u    = data.begin();
-   typename array_type::const_iterator p_v    = v.data.begin();
-   bool                                b_copy = false;
-   const boost::int32_t                ofs    = static_cast<boost::int32_t>(static_cast<boost::int32_t>(ofs_exp) / cpp_dec_float_elem_digits10);
-   array_type                          n_data;
+   typename array_type::pointer       p_u    = data.data();
+   typename array_type::const_pointer p_v    = v.data.data();
+   bool                               b_copy = false;
+   const std::int32_t                 ofs    = static_cast<std::int32_t>(static_cast<std::int32_t>(ofs_exp) / cpp_dec_float_elem_digits10);
+   array_type                         n_data;
 
    if (neg == v.neg)
    {
@@ -726,29 +812,22 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
       // might have to be treated with a positive, negative or zero offset.
       // The result is stored in *this. The data are added one element
       // at a time, each element with carry.
-      if (ofs >= static_cast<boost::int32_t>(0))
+      if (ofs >= static_cast<std::int32_t>(0))
       {
-         std::copy(v.data.begin(), v.data.end() - static_cast<size_t>(ofs), n_data.begin() + static_cast<size_t>(ofs));
-         std::fill(n_data.begin(), n_data.begin() + static_cast<size_t>(ofs), static_cast<boost::uint32_t>(0u));
-         p_v = n_data.begin();
+         std::copy(v.data.cbegin(), v.data.cend() - static_cast<size_t>(ofs), n_data.begin() + static_cast<size_t>(ofs));
+         std::fill(n_data.begin(), n_data.begin() + static_cast<size_t>(ofs), static_cast<std::uint32_t>(0u));
+         p_v = n_data.data();
       }
       else
       {
-         std::copy(data.begin(), data.end() - static_cast<size_t>(-ofs), n_data.begin() + static_cast<size_t>(-ofs));
-         std::fill(n_data.begin(), n_data.begin() + static_cast<size_t>(-ofs), static_cast<boost::uint32_t>(0u));
-         p_u    = n_data.begin();
+         std::copy(data.cbegin(), data.cend() - static_cast<size_t>(-ofs), n_data.begin() + static_cast<size_t>(-ofs));
+         std::fill(n_data.begin(), n_data.begin() + static_cast<size_t>(-ofs), static_cast<std::uint32_t>(0u));
+         p_u    = n_data.data();
          b_copy = true;
       }
 
       // Addition algorithm
-      boost::uint32_t carry = static_cast<boost::uint32_t>(0u);
-
-      for (boost::int32_t j = static_cast<boost::int32_t>(cpp_dec_float_elem_number - static_cast<boost::int32_t>(1)); j >= static_cast<boost::int32_t>(0); j--)
-      {
-         boost::uint32_t t = static_cast<boost::uint32_t>(static_cast<boost::uint32_t>(p_u[j] + p_v[j]) + carry);
-         carry             = t / static_cast<boost::uint32_t>(cpp_dec_float_elem_mask);
-         p_u[j]            = static_cast<boost::uint32_t>(t - static_cast<boost::uint32_t>(carry * static_cast<boost::uint32_t>(cpp_dec_float_elem_mask)));
-      }
+      const std::uint32_t carry = eval_add_n(p_u, p_u, p_v, cpp_dec_float_elem_number);
 
       if (b_copy)
       {
@@ -757,35 +836,35 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
       }
 
       // There needs to be a carry into the element -1 of the array data
-      if (carry != static_cast<boost::uint32_t>(0u))
+      if (carry != static_cast<std::uint32_t>(0u))
       {
-         std::copy_backward(data.begin(), data.end() - static_cast<std::size_t>(1u), data.end());
+         std::copy_backward(data.cbegin(), data.cend() - static_cast<std::size_t>(1u), data.end());
          data[0] = carry;
-         exp += static_cast<ExponentType>(cpp_dec_float_elem_digits10);
+         exp += static_cast<exponent_type>(cpp_dec_float_elem_digits10);
       }
    }
    else
    {
       // Subtract v from *this, where the data array of either *this or v
       // might have to be treated with a positive, negative or zero offset.
-      if ((ofs > static_cast<boost::int32_t>(0)) || ((ofs == static_cast<boost::int32_t>(0)) && (cmp_data(v.data) > static_cast<boost::int32_t>(0))))
+      if ((ofs > static_cast<std::int32_t>(0)) || ((ofs == static_cast<std::int32_t>(0)) && (compare_ranges(data.cbegin(), v.data.cbegin()) > static_cast<std::int32_t>(0))))
       {
          // In this case, |u| > |v| and ofs is positive.
          // Copy the data of v, shifted down to a lower value
          // into the data array m_n. Set the operand pointer p_v
          // to point to the copied, shifted data m_n.
-         std::copy(v.data.begin(), v.data.end() - static_cast<size_t>(ofs), n_data.begin() + static_cast<size_t>(ofs));
-         std::fill(n_data.begin(), n_data.begin() + static_cast<size_t>(ofs), static_cast<boost::uint32_t>(0u));
-         p_v = n_data.begin();
+         std::copy(v.data.cbegin(), v.data.cend() - static_cast<size_t>(ofs), n_data.begin() + static_cast<size_t>(ofs));
+         std::fill(n_data.begin(), n_data.begin() + static_cast<size_t>(ofs), static_cast<std::uint32_t>(0u));
+         p_v = n_data.data();
       }
       else
       {
-         if (ofs != static_cast<boost::int32_t>(0))
+         if (ofs != static_cast<std::int32_t>(0))
          {
             // In this case, |u| < |v| and ofs is negative.
             // Shift the data of u down to a lower value.
-            std::copy_backward(data.begin(), data.end() - static_cast<size_t>(-ofs), data.end());
-            std::fill(data.begin(), data.begin() + static_cast<size_t>(-ofs), static_cast<boost::uint32_t>(0u));
+            std::copy_backward(data.cbegin(), data.cend() - static_cast<size_t>(-ofs), data.end());
+            std::fill(data.begin(), data.begin() + static_cast<size_t>(-ofs), static_cast<std::uint32_t>(0u));
          }
 
          // Copy the data of v into the data array n_data.
@@ -793,34 +872,13 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
          // operand pointer p_v to point to the shifted
          // data m_data.
          n_data = v.data;
-         p_u    = n_data.begin();
-         p_v    = data.begin();
+         p_u    = n_data.data();
+         p_v    = data.data();
          b_copy = true;
       }
 
-      boost::int32_t j;
-
       // Subtraction algorithm
-      boost::int32_t borrow = static_cast<boost::int32_t>(0);
-
-      for (j = static_cast<boost::int32_t>(cpp_dec_float_elem_number - static_cast<boost::int32_t>(1)); j >= static_cast<boost::int32_t>(0); j--)
-      {
-         boost::int32_t t = static_cast<boost::int32_t>(static_cast<boost::int32_t>(static_cast<boost::int32_t>(p_u[j]) - static_cast<boost::int32_t>(p_v[j])) - borrow);
-
-         // Underflow? Borrow?
-         if (t < static_cast<boost::int32_t>(0))
-         {
-            // Yes, underflow and borrow
-            t += static_cast<boost::int32_t>(cpp_dec_float_elem_mask);
-            borrow = static_cast<boost::int32_t>(1);
-         }
-         else
-         {
-            borrow = static_cast<boost::int32_t>(0);
-         }
-
-         p_u[j] = static_cast<boost::uint32_t>(static_cast<boost::uint32_t>(t) % static_cast<boost::uint32_t>(cpp_dec_float_elem_mask));
-      }
+      static_cast<void>(eval_subtract_n(p_u, p_u, p_v, cpp_dec_float_elem_number));
 
       if (b_copy)
       {
@@ -839,7 +897,7 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
             // This result of the subtraction is exactly zero.
             // Reset the sign and the exponent.
             neg = false;
-            exp = static_cast<ExponentType>(0);
+            exp = static_cast<exponent_type>(0);
          }
          else
          {
@@ -847,9 +905,9 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
             const std::size_t sj = static_cast<std::size_t>(std::distance<typename array_type::const_iterator>(data.begin(), first_nonzero_elem));
 
             std::copy(data.begin() + static_cast<std::size_t>(sj), data.end(), data.begin());
-            std::fill(data.end() - sj, data.end(), static_cast<boost::uint32_t>(0u));
+            std::fill(data.end() - sj, data.end(), static_cast<std::uint32_t>(0u));
 
-            exp -= static_cast<ExponentType>(sj * static_cast<std::size_t>(cpp_dec_float_elem_digits10));
+            exp -= static_cast<exponent_type>(sj * static_cast<std::size_t>(cpp_dec_float_elem_digits10));
          }
       }
    }
@@ -859,7 +917,7 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
       return (*this = zero());
 
    // Check for potential overflow.
-   const bool b_result_might_overflow = (exp >= static_cast<ExponentType>(cpp_dec_float_max_exp10));
+   const bool b_result_might_overflow = (exp >= static_cast<exponent_type>(cpp_dec_float_max_exp10));
 
    // Handle overflow.
    if (b_result_might_overflow)
@@ -921,29 +979,15 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
    }
 
    // Check for potential overflow or underflow.
-   const bool b_result_might_overflow  = ((exp + v.exp) >= static_cast<ExponentType>(cpp_dec_float_max_exp10));
-   const bool b_result_might_underflow = ((exp + v.exp) <= static_cast<ExponentType>(cpp_dec_float_min_exp10));
+   const bool b_result_might_overflow  = ((exp + v.exp) >= static_cast<exponent_type>(cpp_dec_float_max_exp10));
+   const bool b_result_might_underflow = ((exp + v.exp) <= static_cast<exponent_type>(cpp_dec_float_min_exp10));
 
    // Set the exponent of the result.
    exp += v.exp;
 
-   const boost::int32_t prec_mul = (std::min)(prec_elem, v.prec_elem);
-
-   const boost::uint32_t carry = mul_loop_uv(data.data(), v.data.data(), prec_mul);
-
-   // Handle a potential carry.
-   if (carry != static_cast<boost::uint32_t>(0u))
-   {
-      exp += cpp_dec_float_elem_digits10;
-
-      // Shift the result of the multiplication one element to the right...
-      std::copy_backward(data.begin(),
-                         data.begin() + static_cast<std::size_t>(prec_elem - static_cast<boost::int32_t>(1)),
-                         data.begin() + static_cast<std::size_t>(prec_elem));
+   const std::int32_t prec_mul = (std::min)(prec_elem, v.prec_elem);
 
-      // ... And insert the carry.
-      data.front() = carry;
-   }
+   eval_mul_dispatch_multiplication_method(v, prec_mul);
 
    // Handle overflow.
    if (b_result_might_overflow && (compare((cpp_dec_float::max)()) > 0))
@@ -980,7 +1024,7 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
       }
    }
 
-   const bool u_and_v_are_finite_and_identical = ((isfinite)() && (fpclass == v.fpclass) && (exp == v.exp) && (cmp_data(v.data) == static_cast<boost::int32_t>(0)));
+   const bool u_and_v_are_finite_and_identical = ((isfinite)() && (fpclass == v.fpclass) && (exp == v.exp) && (compare_ranges(data.cbegin(), v.data.cbegin()) == static_cast<std::int32_t>(0)));
 
    if (u_and_v_are_finite_and_identical)
    {
@@ -1002,9 +1046,9 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
 }
 
 template <unsigned Digits10, class ExponentType, class Allocator>
-cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, ExponentType, Allocator>::mul_unsigned_long_long(const boost::ulong_long_type n)
+cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, ExponentType, Allocator>::mul_unsigned_long_long(const unsigned long long n)
 {
-   // Multiply *this with a constant boost::ulong_long_type.
+   // Multiply *this with a constant unsigned long long.
 
    // Evaluate the sign of the result.
    const bool b_neg = neg;
@@ -1014,7 +1058,7 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
 
    // Handle special cases like zero, inf and NaN.
    const bool b_u_is_inf  = (isinf)();
-   const bool b_n_is_zero = (n == static_cast<boost::int32_t>(0));
+   const bool b_n_is_zero = (n == static_cast<std::int32_t>(0));
 
    if ((isnan)() || (b_u_is_inf && b_n_is_zero))
    {
@@ -1035,7 +1079,7 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
       return *this = zero();
    }
 
-   if (n >= static_cast<boost::ulong_long_type>(cpp_dec_float_elem_mask))
+   if (n >= static_cast<unsigned long long>(cpp_dec_float_elem_mask))
    {
       neg = b_neg;
       cpp_dec_float t;
@@ -1043,27 +1087,27 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
       return operator*=(t);
    }
 
-   if (n == static_cast<boost::ulong_long_type>(1u))
+   if (n == static_cast<unsigned long long>(1u))
    {
       neg = b_neg;
       return *this;
    }
 
    // Set up the multiplication loop.
-   const boost::uint32_t nn    = static_cast<boost::uint32_t>(n);
-   const boost::uint32_t carry = mul_loop_n(data.data(), nn, prec_elem);
+   const std::uint32_t nn    = static_cast<std::uint32_t>(n);
+   const std::uint32_t carry = mul_loop_n(data.data(), nn, prec_elem);
 
    // Handle the carry and adjust the exponent.
-   if (carry != static_cast<boost::uint32_t>(0u))
+   if (carry != static_cast<std::uint32_t>(0u))
    {
-      exp += static_cast<ExponentType>(cpp_dec_float_elem_digits10);
+      exp += static_cast<exponent_type>(cpp_dec_float_elem_digits10);
 
       // Shift the result of the multiplication one element to the right.
       std::copy_backward(data.begin(),
-                         data.begin() + static_cast<std::size_t>(prec_elem - static_cast<boost::int32_t>(1)),
+                         data.begin() + static_cast<std::size_t>(prec_elem - static_cast<std::int32_t>(1)),
                          data.begin() + static_cast<std::size_t>(prec_elem));
 
-      data.front() = static_cast<boost::uint32_t>(carry);
+      data.front() = static_cast<std::uint32_t>(carry);
    }
 
    // Check for potential overflow.
@@ -1082,9 +1126,9 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
 }
 
 template <unsigned Digits10, class ExponentType, class Allocator>
-cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, ExponentType, Allocator>::div_unsigned_long_long(const boost::ulong_long_type n)
+cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, ExponentType, Allocator>::div_unsigned_long_long(const unsigned long long n)
 {
-   // Divide *this by a constant boost::ulong_long_type.
+   // Divide *this by a constant unsigned long long.
 
    // Evaluate the sign of the result.
    const bool b_neg = neg;
@@ -1106,7 +1150,7 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
       return *this;
    }
 
-   if (n == static_cast<boost::ulong_long_type>(0u))
+   if (n == static_cast<unsigned long long>(0u))
    {
       // Divide by 0.
       if (iszero())
@@ -1128,7 +1172,7 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
       return *this;
    }
 
-   if (n >= static_cast<boost::ulong_long_type>(cpp_dec_float_elem_mask))
+   if (n >= static_cast<unsigned long long>(cpp_dec_float_elem_mask))
    {
       neg = b_neg;
       cpp_dec_float t;
@@ -1136,25 +1180,25 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
       return operator/=(t);
    }
 
-   const boost::uint32_t nn = static_cast<boost::uint32_t>(n);
+   const std::uint32_t nn = static_cast<std::uint32_t>(n);
 
-   if (nn > static_cast<boost::uint32_t>(1u))
+   if (nn > static_cast<std::uint32_t>(1u))
    {
       // Do the division loop.
-      const boost::uint32_t prev = div_loop_n(data.data(), nn, prec_elem);
+      const std::uint32_t prev = div_loop_n(data.data(), nn, prec_elem);
 
       // Determine if one leading zero is in the result data.
-      if (data[0] == static_cast<boost::uint32_t>(0u))
+      if (data[0] == static_cast<std::uint32_t>(0u))
       {
          // Adjust the exponent
-         exp -= static_cast<ExponentType>(cpp_dec_float_elem_digits10);
+         exp -= static_cast<exponent_type>(cpp_dec_float_elem_digits10);
 
          // Shift result of the division one element to the left.
          std::copy(data.begin() + static_cast<std::size_t>(1u),
-                   data.begin() + static_cast<std::size_t>(prec_elem - static_cast<boost::int32_t>(1)),
+                   data.begin() + static_cast<std::size_t>(prec_elem - static_cast<std::int32_t>(1)),
                    data.begin());
 
-         data[prec_elem - static_cast<boost::int32_t>(1)] = static_cast<boost::uint32_t>(static_cast<boost::uint64_t>(prev * static_cast<boost::uint64_t>(cpp_dec_float_elem_mask)) / nn);
+         data[static_cast<std::size_t>(prec_elem - static_cast<std::int32_t>(1))] = static_cast<std::uint32_t>(static_cast<std::uint64_t>(prev * static_cast<std::uint64_t>(cpp_dec_float_elem_mask)) / nn);
       }
    }
 
@@ -1211,8 +1255,8 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
    // Generate the initial estimate using division.
    // Extract the mantissa and exponent for a "manual"
    // computation of the estimate.
-   double       dd;
-   ExponentType ne;
+   double        dd;
+   exponent_type ne;
    x.extract_parts(dd, ne);
 
    // Do the inverse estimate using double precision estimates of mantissa and exponent.
@@ -1222,13 +1266,13 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
    // is used. During the iterative steps, the precision of the calculation is limited
    // to the minimum required in order to minimize the run-time.
 
-   static const boost::int32_t double_digits10_minus_a_few = std::numeric_limits<double>::digits10 - 3;
+   constexpr std::int32_t double_digits10_minus_a_few = std::numeric_limits<double>::digits10 - 3;
 
-   for (boost::int32_t digits = double_digits10_minus_a_few; digits <= cpp_dec_float_total_digits10; digits *= static_cast<boost::int32_t>(2))
+   for (std::int32_t digits = double_digits10_minus_a_few; digits <= cpp_dec_float_max_digits10; digits *= static_cast<std::int32_t>(2))
    {
       // Adjust precision of the terms.
-      precision(static_cast<boost::int32_t>((digits + 10) * static_cast<boost::int32_t>(2)));
-      x.precision(static_cast<boost::int32_t>((digits + 10) * static_cast<boost::int32_t>(2)));
+      precision(static_cast<std::int32_t>((digits + 10) * static_cast<std::int32_t>(2)));
+      x.precision(static_cast<std::int32_t>((digits + 10) * static_cast<std::int32_t>(2)));
 
       // Next iteration.
       cpp_dec_float t(*this);
@@ -1273,12 +1317,12 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
    // Generate the initial estimate using division.
    // Extract the mantissa and exponent for a "manual"
    // computation of the estimate.
-   double       dd;
-   ExponentType ne;
+   double        dd;
+   exponent_type ne;
    extract_parts(dd, ne);
 
    // Force the exponent to be an even multiple of two.
-   if ((ne % static_cast<ExponentType>(2)) != static_cast<ExponentType>(0))
+   if ((ne % static_cast<exponent_type>(2)) != static_cast<exponent_type>(0))
    {
       ++ne;
       dd /= 10.0;
@@ -1299,13 +1343,12 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
    // limited to the minimum required in order to minimize
    // the run-time.
    //
-   // Book references:
-   // https://doi.org/10.1007/978-3-642-56735-3
-   // http://www.amazon.com/exec/obidos/tg/detail/-/3540665722/qid=1035535482/sr=8-7/ref=sr_8_7/104-3357872-6059916?v=glance&n=507846
+   // Book reference to "Pi Unleashed:
+   // https://www.springer.com/gp/book/9783642567353
 
-   static const boost::uint32_t double_digits10_minus_a_few = std::numeric_limits<double>::digits10 - 3;
+   constexpr std::uint32_t double_digits10_minus_a_few = std::numeric_limits<double>::digits10 - 3;
 
-   for (boost::int32_t digits = double_digits10_minus_a_few; digits <= cpp_dec_float_total_digits10; digits *= 2u)
+   for (std::int32_t digits = double_digits10_minus_a_few; digits <= cpp_dec_float_max_digits10; digits *= 2)
    {
       // Adjust precision of the terms.
       precision((digits + 10) * 2);
@@ -1334,28 +1377,6 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
    return *this;
 }
 
-template <unsigned Digits10, class ExponentType, class Allocator>
-int cpp_dec_float<Digits10, ExponentType, Allocator>::cmp_data(const array_type& vd) const
-{
-   // Compare the data of *this with those of v.
-   // Return +1 for *this > v
-   // 0 for *this = v
-   // -1 for *this < v
-
-   const std::pair<typename array_type::const_iterator, typename array_type::const_iterator> mismatch_pair = std::mismatch(data.begin(), data.end(), vd.begin());
-
-   const bool is_equal = ((mismatch_pair.first == data.end()) && (mismatch_pair.second == vd.end()));
-
-   if (is_equal)
-   {
-      return 0;
-   }
-   else
-   {
-      return ((*mismatch_pair.first > *mismatch_pair.second) ? 1 : -1);
-   }
-}
-
 template <unsigned Digits10, class ExponentType, class Allocator>
 int cpp_dec_float<Digits10, ExponentType, Allocator>::compare(const cpp_dec_float& v) const
 {
@@ -1430,7 +1451,7 @@ int cpp_dec_float<Digits10, ExponentType, Allocator>::compare(const cpp_dec_floa
       {
          // The signs are the same and the exponents are the same.
          // Compare the data.
-         const int val_cmp_data = cmp_data(v.data);
+         const int val_cmp_data = compare_ranges(data.cbegin(), v.data.cbegin());
 
          return ((!neg) ? val_cmp_data : -val_cmp_data);
       }
@@ -1446,12 +1467,12 @@ bool cpp_dec_float<Digits10, ExponentType, Allocator>::isone() const
 
    if (not_negative_and_is_finite)
    {
-      if ((data[0u] == static_cast<boost::uint32_t>(1u)) && (exp == static_cast<ExponentType>(0)))
+      if ((data[0u] == static_cast<std::uint32_t>(1u)) && (exp == static_cast<exponent_type>(0)))
       {
          const typename array_type::const_iterator it_non_zero = std::find_if(data.begin(), data.end(), data_elem_is_non_zero_predicate);
          return (it_non_zero == data.end());
       }
-      else if ((data[0u] == static_cast<boost::uint32_t>(cpp_dec_float_elem_mask - 1)) && (exp == static_cast<ExponentType>(-cpp_dec_float_elem_digits10)))
+      else if ((data[0u] == static_cast<std::uint32_t>(cpp_dec_float_elem_mask - 1)) && (exp == static_cast<exponent_type>(-cpp_dec_float_elem_digits10)))
       {
          const typename array_type::const_iterator it_non_nine = std::find_if(data.begin(), data.end(), data_elem_is_non_nine_predicate);
          return (it_non_nine == data.end());
@@ -1474,7 +1495,7 @@ bool cpp_dec_float<Digits10, ExponentType, Allocator>::isint() const
       return true;
    }
 
-   if (exp < static_cast<ExponentType>(0))
+   if (exp < static_cast<exponent_type>(0))
    {
       return false;
    } // |*this| < 1.
@@ -1501,27 +1522,27 @@ void cpp_dec_float<Digits10, ExponentType, Allocator>::extract_parts(double& man
    // Extracts the mantissa and exponent.
    exponent = exp;
 
-   boost::uint32_t p10  = static_cast<boost::uint32_t>(1u);
-   boost::uint32_t test = data[0u];
+   std::uint32_t p10  = static_cast<std::uint32_t>(1u);
+   std::uint32_t test = data[0u];
 
    for (;;)
    {
-      test /= static_cast<boost::uint32_t>(10u);
+      test /= static_cast<std::uint32_t>(10u);
 
-      if (test == static_cast<boost::uint32_t>(0u))
+      if (test == static_cast<std::uint32_t>(0u))
       {
          break;
       }
 
-      p10 *= static_cast<boost::uint32_t>(10u);
+      p10 *= static_cast<std::uint32_t>(10u);
       ++exponent;
    }
 
    // Establish the upper bound of limbs for extracting the double.
-   const int max_elem_in_double_count = static_cast<int>(static_cast<boost::int32_t>(std::numeric_limits<double>::digits10) / cpp_dec_float_elem_digits10) + (static_cast<int>(static_cast<boost::int32_t>(std::numeric_limits<double>::digits10) % cpp_dec_float_elem_digits10) != 0 ? 1 : 0) + 1;
+   const int max_elem_in_double_count = static_cast<int>(static_cast<std::int32_t>(std::numeric_limits<double>::digits10) / cpp_dec_float_elem_digits10) + (static_cast<int>(static_cast<std::int32_t>(std::numeric_limits<double>::digits10) % cpp_dec_float_elem_digits10) != 0 ? 1 : 0) + 1;
 
    // And make sure this upper bound stays within bounds of the elems.
-   const std::size_t max_elem_extract_count = static_cast<std::size_t>((std::min)(static_cast<boost::int32_t>(max_elem_in_double_count), cpp_dec_float_elem_number));
+   const std::size_t max_elem_extract_count = static_cast<std::size_t>((std::min)(static_cast<std::int32_t>(max_elem_in_double_count), cpp_dec_float_elem_number));
 
    // Extract into the mantissa the first limb, extracted as a double.
    mantissa     = static_cast<double>(data[0]);
@@ -1578,15 +1599,7 @@ double cpp_dec_float<Digits10, ExponentType, Allocator>::extract_double() const
                      : -std::numeric_limits<double>::infinity());
    }
 
-   std::stringstream ss;
-   ss.imbue(std::locale::classic());
-
-   ss << str(std::numeric_limits<double>::digits10 + (2 + 1), std::ios_base::scientific);
-
-   double d;
-   ss >> d;
-
-   return d;
+   return std::strtod(str(std::numeric_limits<double>::digits10 + (2 + 1), std::ios_base::scientific).c_str(), nullptr);
 }
 
 template <unsigned Digits10, class ExponentType, class Allocator>
@@ -1625,70 +1638,62 @@ long double cpp_dec_float<Digits10, ExponentType, Allocator>::extract_long_doubl
                      : -std::numeric_limits<long double>::infinity());
    }
 
-   std::stringstream ss;
-   ss.imbue(std::locale::classic());
-
-   ss << str(std::numeric_limits<long double>::digits10 + (2 + 1), std::ios_base::scientific);
-
-   long double ld;
-   ss >> ld;
-
-   return ld;
+   return std::strtold(str(std::numeric_limits<long double>::digits10 + (2 + 1), std::ios_base::scientific).c_str(), nullptr);
 }
 
 template <unsigned Digits10, class ExponentType, class Allocator>
-boost::long_long_type cpp_dec_float<Digits10, ExponentType, Allocator>::extract_signed_long_long() const
+long long cpp_dec_float<Digits10, ExponentType, Allocator>::extract_signed_long_long() const
 {
    // Extracts a signed long long from *this.
    // If (x > maximum of long long) or (x < minimum of long long),
    // then the maximum or minimum of long long is returned accordingly.
 
-   if (exp < static_cast<ExponentType>(0))
+   if (exp < static_cast<exponent_type>(0))
    {
-      return static_cast<boost::long_long_type>(0);
+      return static_cast<long long>(0);
    }
 
    const bool b_neg = isneg();
 
-   boost::ulong_long_type val;
+   unsigned long long val;
 
    if ((!b_neg) && (compare(long_long_max()) > 0))
    {
-      return (std::numeric_limits<boost::long_long_type>::max)();
+      return (std::numeric_limits<long long>::max)();
    }
    else if (b_neg && (compare(long_long_min()) < 0))
    {
-      return (std::numeric_limits<boost::long_long_type>::min)();
+      return (std::numeric_limits<long long>::min)();
    }
    else
    {
-      // Extract the data into an boost::ulong_long_type value.
+      // Extract the data into an unsigned long long value.
       cpp_dec_float<Digits10, ExponentType, Allocator> xn(extract_integer_part());
       if (xn.isneg())
          xn.negate();
 
-      val = static_cast<boost::ulong_long_type>(xn.data[0]);
+      val = static_cast<unsigned long long>(xn.data[0]);
 
-      const boost::int32_t imax = (std::min)(static_cast<boost::int32_t>(static_cast<boost::int32_t>(xn.exp) / cpp_dec_float_elem_digits10), static_cast<boost::int32_t>(cpp_dec_float_elem_number - static_cast<boost::int32_t>(1)));
+      const std::int32_t imax = (std::min)(static_cast<std::int32_t>(static_cast<std::int32_t>(xn.exp) / cpp_dec_float_elem_digits10), static_cast<std::int32_t>(cpp_dec_float_elem_number - static_cast<std::int32_t>(1)));
 
-      for (boost::int32_t i = static_cast<boost::int32_t>(1); i <= imax; i++)
+      for (std::int32_t i = static_cast<std::int32_t>(1); i <= imax; i++)
       {
-         val *= static_cast<boost::ulong_long_type>(cpp_dec_float_elem_mask);
-         val += static_cast<boost::ulong_long_type>(xn.data[i]);
+         val *= static_cast<unsigned long long>(cpp_dec_float_elem_mask);
+         val += static_cast<unsigned long long>(xn.data[static_cast<std::size_t>(i)]);
       }
    }
 
    if (!b_neg)
    {
-      return static_cast<boost::long_long_type>(val);
+      return static_cast<long long>(val);
    }
    else
    {
       // This strange expression avoids a hardware trap in the corner case
-      // that val is the most negative value permitted in boost::long_long_type.
+      // that val is the most negative value permitted in long long.
       // See https://svn.boost.org/trac/boost/ticket/9740.
       //
-      boost::long_long_type sval = static_cast<boost::long_long_type>(val - 1);
+      long long sval = static_cast<long long>(val - 1);
       sval                       = -sval;
       --sval;
       return sval;
@@ -1696,49 +1701,162 @@ boost::long_long_type cpp_dec_float<Digits10, ExponentType, Allocator>::extract_
 }
 
 template <unsigned Digits10, class ExponentType, class Allocator>
-boost::ulong_long_type cpp_dec_float<Digits10, ExponentType, Allocator>::extract_unsigned_long_long() const
+unsigned long long cpp_dec_float<Digits10, ExponentType, Allocator>::extract_unsigned_long_long() const
 {
-   // Extracts an boost::ulong_long_type from *this.
-   // If x exceeds the maximum of boost::ulong_long_type,
-   // then the maximum of boost::ulong_long_type is returned.
-   // If x is negative, then the boost::ulong_long_type cast of
+   // Extracts an unsigned long long from *this.
+   // If x exceeds the maximum of unsigned long long,
+   // then the maximum of unsigned long long is returned.
+   // If x is negative, then the unsigned long long cast of
    // the long long extracted value is returned.
 
    if (isneg())
    {
-      return static_cast<boost::ulong_long_type>(extract_signed_long_long());
+      return static_cast<unsigned long long>(extract_signed_long_long());
    }
 
-   if (exp < static_cast<ExponentType>(0))
+   if (exp < static_cast<exponent_type>(0))
    {
-      return static_cast<boost::ulong_long_type>(0u);
+      return static_cast<unsigned long long>(0u);
    }
 
    const cpp_dec_float<Digits10, ExponentType, Allocator> xn(extract_integer_part());
 
-   boost::ulong_long_type val;
+   unsigned long long val;
 
    if (xn.compare(ulong_long_max()) > 0)
    {
-      return (std::numeric_limits<boost::ulong_long_type>::max)();
+      return (std::numeric_limits<unsigned long long>::max)();
    }
    else
    {
-      // Extract the data into an boost::ulong_long_type value.
-      val = static_cast<boost::ulong_long_type>(xn.data[0]);
+      // Extract the data into an unsigned long long value.
+      val = static_cast<unsigned long long>(xn.data[0]);
 
-      const boost::int32_t imax = (std::min)(static_cast<boost::int32_t>(static_cast<boost::int32_t>(xn.exp) / cpp_dec_float_elem_digits10), static_cast<boost::int32_t>(cpp_dec_float_elem_number - static_cast<boost::int32_t>(1)));
+      const std::int32_t imax = (std::min)(static_cast<std::int32_t>(static_cast<std::int32_t>(xn.exp) / cpp_dec_float_elem_digits10), static_cast<std::int32_t>(cpp_dec_float_elem_number - static_cast<std::int32_t>(1)));
 
-      for (boost::int32_t i = static_cast<boost::int32_t>(1); i <= imax; i++)
+      for (std::int32_t i = static_cast<std::int32_t>(1); i <= imax; i++)
       {
-         val *= static_cast<boost::ulong_long_type>(cpp_dec_float_elem_mask);
-         val += static_cast<boost::ulong_long_type>(xn.data[i]);
+         val *= static_cast<unsigned long long>(cpp_dec_float_elem_mask);
+         val += static_cast<unsigned long long>(xn.data[i]);
       }
    }
 
    return val;
 }
 
+#ifdef BOOST_HAS_INT128
+
+template <unsigned Digits10, class ExponentType, class Allocator>
+int128_type cpp_dec_float<Digits10, ExponentType, Allocator>::extract_signed_int128() const
+{
+   // Extracts a signed __int128 from *this.
+   // If (x > maximum of __int128) or (x < minimum of __int128),
+   // then the maximum or minimum of long long is returned accordingly.
+
+   if (exp < static_cast<exponent_type>(0))
+   {
+      return static_cast<int128_type>(0);
+   }
+
+   const bool b_neg = isneg();
+   cpp_dec_float<Digits10, ExponentType, Allocator> i128max;
+   i128max = ((~static_cast<uint128_type>(0)) >> 1);
+   cpp_dec_float<Digits10, ExponentType, Allocator> i128min;
+   i128min = (-1 - static_cast<int128_type>((static_cast<uint128_type>(1) << 127) - 1));
+
+   uint128_type val;
+
+   if ((!b_neg) && (compare(i128max) > 0))
+   {
+      return ((~static_cast<uint128_type>(0)) >> 1);
+   }
+   else if (b_neg && (compare(i128min) < 0))
+   {
+      return (-1 - static_cast<int128_type>((static_cast<uint128_type>(1) << 127) - 1));
+   }
+   else
+   {
+      // Extract the data into an unsigned long long value.
+      cpp_dec_float<Digits10, ExponentType, Allocator> xn(extract_integer_part());
+      if (xn.isneg())
+         xn.negate();
+
+      val = static_cast<uint128_type>(xn.data[0]);
+
+      const std::int32_t imax = (std::min)(static_cast<std::int32_t>(static_cast<std::int32_t>(xn.exp) / cpp_dec_float_elem_digits10), static_cast<std::int32_t>(cpp_dec_float_elem_number - static_cast<std::int32_t>(1)));
+
+      for (std::int32_t i = static_cast<std::int32_t>(1); i <= imax; i++)
+      {
+         val *= static_cast<uint128_type>(cpp_dec_float_elem_mask);
+         val += static_cast<uint128_type>(xn.data[static_cast<std::size_t>(i)]);
+      }
+   }
+
+   if (!b_neg)
+   {
+      return static_cast<int128_type>(val);
+   }
+   else
+   {
+      // This strange expression avoids a hardware trap in the corner case
+      // that val is the most negative value permitted in long long.
+      // See https://svn.boost.org/trac/boost/ticket/9740.
+      //
+      int128_type sval = static_cast<int128_type>(val - 1);
+      sval                       = -sval;
+      --sval;
+      return sval;
+   }
+}
+
+template <unsigned Digits10, class ExponentType, class Allocator>
+uint128_type cpp_dec_float<Digits10, ExponentType, Allocator>::extract_unsigned_int128() const
+{
+   // Extracts an unsigned __int128 from *this.
+   // If x exceeds the maximum of unsigned __int128,
+   // then the maximum of unsigned __int128 is returned.
+   // If x is negative, then the unsigned __int128 cast of
+   // the __int128 extracted value is returned.
+
+   if (isneg())
+   {
+      return static_cast<uint128_type>(extract_signed_int128());
+   }
+
+   if (exp < static_cast<exponent_type>(0))
+   {
+      return 0u;
+   }
+
+   const cpp_dec_float<Digits10, ExponentType, Allocator> xn(extract_integer_part());
+   cpp_dec_float<Digits10, ExponentType, Allocator>       i128max;
+   i128max = (~static_cast<uint128_type>(0));
+
+   uint128_type val;
+
+   if (xn.compare(i128max) > 0)
+   {
+      return (~static_cast<uint128_type>(0));
+   }
+   else
+   {
+      // Extract the data into an unsigned long long value.
+      val = static_cast<uint128_type>(xn.data[0]);
+
+      const std::int32_t imax = (std::min)(static_cast<std::int32_t>(static_cast<std::int32_t>(xn.exp) / cpp_dec_float_elem_digits10), static_cast<std::int32_t>(cpp_dec_float_elem_number - static_cast<std::int32_t>(1)));
+
+      for (std::int32_t i = static_cast<std::int32_t>(1); i <= imax; i++)
+      {
+         val *= static_cast<uint128_type>(cpp_dec_float_elem_mask);
+         val += static_cast<uint128_type>(xn.data[i]);
+      }
+   }
+
+   return val;
+}
+
+#endif
+
 template <unsigned Digits10, class ExponentType, class Allocator>
 cpp_dec_float<Digits10, ExponentType, Allocator> cpp_dec_float<Digits10, ExponentType, Allocator>::extract_integer_part() const
 {
@@ -1767,13 +1885,13 @@ cpp_dec_float<Digits10, ExponentType, Allocator> cpp_dec_float<Digits10, Exponen
    const size_t last_clear  = static_cast<size_t>(cpp_dec_float_elem_number);
 
    if (first_clear < last_clear)
-      std::fill(x.data.begin() + first_clear, x.data.begin() + last_clear, static_cast<boost::uint32_t>(0u));
+      std::fill(x.data.begin() + first_clear, x.data.begin() + last_clear, static_cast<std::uint32_t>(0u));
 
    return x;
 }
 
 template <unsigned Digits10, class ExponentType, class Allocator>
-std::string cpp_dec_float<Digits10, ExponentType, Allocator>::str(boost::intmax_t number_of_digits, std::ios_base::fmtflags f) const
+std::string cpp_dec_float<Digits10, ExponentType, Allocator>::str(std::intmax_t number_of_digits, std::ios_base::fmtflags f) const
 {
    if ((this->isinf)())
    {
@@ -1790,11 +1908,11 @@ std::string cpp_dec_float<Digits10, ExponentType, Allocator>::str(boost::intmax_
    }
 
    std::string     str;
-   boost::intmax_t org_digits(number_of_digits);
-   ExponentType    my_exp = order();
+   std::intmax_t org_digits(number_of_digits);
+   exponent_type    my_exp = order();
 
-   if (number_of_digits == 0)
-      number_of_digits = cpp_dec_float_total_digits10;
+   if (!(f & std::ios_base::fixed) && (number_of_digits == 0))
+      number_of_digits = cpp_dec_float_max_digits10;
 
    if (f & std::ios_base::fixed)
    {
@@ -1826,8 +1944,11 @@ std::string cpp_dec_float<Digits10, ExponentType, Allocator>::str(boost::intmax_
       // We only get here if the output format is "fixed" and we just need to
       // round the first non-zero digit.
       number_of_digits -= my_exp + 1; // reset to original value
-      str.insert(static_cast<std::string::size_type>(0), std::string::size_type(number_of_digits), '0');
-      have_leading_zeros = true;
+      if (number_of_digits)
+      {
+         str.insert(static_cast<std::string::size_type>(0), std::string::size_type(number_of_digits), '0');
+         have_leading_zeros = true;
+      }
    }
 
    if (number_of_digits < 0)
@@ -1844,13 +1965,13 @@ std::string cpp_dec_float<Digits10, ExponentType, Allocator>::str(boost::intmax_
       if (str.length() > static_cast<std::string::size_type>(number_of_digits))
       {
          // Get the digit after the last needed digit for rounding
-         const boost::uint32_t round = static_cast<boost::uint32_t>(static_cast<boost::uint32_t>(str[static_cast<std::string::size_type>(number_of_digits)]) - static_cast<boost::uint32_t>('0'));
+         const std::uint32_t round = static_cast<std::uint32_t>(static_cast<std::uint32_t>(str[static_cast<std::string::size_type>(number_of_digits)]) - static_cast<std::uint32_t>('0'));
 
          bool need_round_up = round >= 5u;
 
          if (round == 5u)
          {
-            const boost::uint32_t ix = static_cast<boost::uint32_t>(static_cast<boost::uint32_t>(str[static_cast<std::string::size_type>(number_of_digits - 1)]) - static_cast<boost::uint32_t>('0'));
+            const std::uint32_t ix = number_of_digits == 0 ? 0 : static_cast<std::uint32_t>(static_cast<std::uint32_t>(str[static_cast<std::string::size_type>(number_of_digits - 1)]) - static_cast<std::uint32_t>('0'));
             if ((ix & 1u) == 0)
             {
                // We have an even digit followed by a 5, so we might not actually need to round up
@@ -1878,34 +1999,42 @@ std::string cpp_dec_float<Digits10, ExponentType, Allocator>::str(boost::intmax_
 
          if (need_round_up)
          {
-            std::size_t ix = static_cast<std::size_t>(str.length() - 1u);
-
-            // Every trailing 9 must be rounded up
-            while (ix && (static_cast<boost::int32_t>(str.at(ix)) - static_cast<boost::int32_t>('0') == static_cast<boost::int32_t>(9)))
+            if (str.size())
             {
-               str.at(ix) = static_cast<char>('0');
-               --ix;
-            }
+               std::size_t ix = static_cast<std::size_t>(str.length() - 1u);
 
-            if (!ix)
-            {
-               // There were nothing but trailing nines.
-               if (static_cast<boost::int32_t>(static_cast<boost::int32_t>(str.at(ix)) - static_cast<boost::int32_t>(0x30)) == static_cast<boost::int32_t>(9))
+               // Every trailing 9 must be rounded up
+               while (ix && (static_cast<std::int32_t>(str.at(ix)) - static_cast<std::int32_t>('0') == static_cast<std::int32_t>(9)))
+               {
+                  str.at(ix) = static_cast<char>('0');
+                  --ix;
+               }
+
+               if (!ix)
                {
-                  // Increment up to the next order and adjust exponent.
-                  str.at(ix) = static_cast<char>('1');
-                  ++my_exp;
+                  // There were nothing but trailing nines.
+                  if (static_cast<std::int32_t>(static_cast<std::int32_t>(str.at(ix)) - static_cast<std::int32_t>(0x30)) == static_cast<std::int32_t>(9))
+                  {
+                     // Increment up to the next order and adjust exponent.
+                     str.at(ix) = static_cast<char>('1');
+                     ++my_exp;
+                  }
+                  else
+                  {
+                     // Round up this digit.
+                     ++str.at(ix);
+                  }
                }
                else
                {
-                  // Round up this digit.
-                  ++str.at(ix);
+                  // Round up the last digit.
+                  ++str[ix];
                }
             }
             else
             {
-               // Round up the last digit.
-               ++str[ix];
+               str = "1";
+               ++my_exp;
             }
          }
       }
@@ -1945,14 +2074,19 @@ bool cpp_dec_float<Digits10, ExponentType, Allocator>::rd_string(const char* con
       // the code complexity (and perhaps the run-time) of rd_string().
 
       // Get a possible exponent and remove it.
-      exp = static_cast<ExponentType>(0);
+      exp = static_cast<exponent_type>(0);
 
       std::size_t pos;
 
       if (((pos = str.find('e')) != std::string::npos) || ((pos = str.find('E')) != std::string::npos))
       {
          // Remove the exponent part from the string.
-         exp = boost::lexical_cast<ExponentType>(static_cast<const char*>(str.c_str() + (pos + 1u)));
+         #ifndef BOOST_MP_STANDALONE
+         exp = boost::lexical_cast<exponent_type>(static_cast<const char*>(str.c_str() + (pos + 1u)));
+         #else
+         exp = static_cast<exponent_type>(std::atoll(static_cast<const char*>(str.c_str() + (pos + 1u))));
+         #endif
+         
          str = str.substr(static_cast<std::size_t>(0u), pos);
       }
 
@@ -2025,8 +2159,13 @@ bool cpp_dec_float<Digits10, ExponentType, Allocator>::rd_string(const char* con
 
          if (rit_non_zero != static_cast<std::string::const_reverse_iterator>(str.rbegin()))
          {
-            const std::string::size_type ofs = str.length() - std::distance<std::string::const_reverse_iterator>(str.rbegin(), rit_non_zero);
-            str.erase(str.begin() + ofs, str.end());
+            const std::string::size_type ofs =
+               static_cast<std::string::size_type>
+               (
+                    static_cast<std::ptrdiff_t>(str.length())
+                  - std::distance<std::string::const_reverse_iterator>(str.rbegin(), rit_non_zero)
+               );
+            str.erase(str.begin() + static_cast<std::ptrdiff_t>(ofs), str.end());
          }
 
          // Check if the input is identically zero.
@@ -2048,13 +2187,13 @@ bool cpp_dec_float<Digits10, ExponentType, Allocator>::rd_string(const char* con
 
             if (str.at(static_cast<std::size_t>(1u)) == static_cast<char>('0'))
             {
-               delta_exp = std::distance<std::string::const_iterator>(str.begin() + 1u, it_non_zero);
+               delta_exp = static_cast<std::size_t>(std::distance<std::string::const_iterator>(str.begin() + 1u, it_non_zero));
             }
 
             // Bring one single digit into the mantissa and adjust the exponent accordingly.
             str.erase(str.begin(), it_non_zero);
             str.insert(static_cast<std::string::size_type>(1u), ".");
-            exp -= static_cast<ExponentType>(delta_exp + 1u);
+            exp -= static_cast<exponent_type>(delta_exp + 1u);
          }
       }
       else
@@ -2064,68 +2203,74 @@ bool cpp_dec_float<Digits10, ExponentType, Allocator>::rd_string(const char* con
       }
 
       // Shift the decimal point such that the exponent is an even multiple of cpp_dec_float_elem_digits10.
-      std::size_t       n_shift   = static_cast<std::size_t>(0u);
-      const std::size_t n_exp_rem = static_cast<std::size_t>(exp % static_cast<ExponentType>(cpp_dec_float_elem_digits10));
+      std::ptrdiff_t       n_shift   = static_cast<std::ptrdiff_t>(0);
+      const std::ptrdiff_t n_exp_rem = static_cast<std::ptrdiff_t>(exp % static_cast<exponent_type>(cpp_dec_float_elem_digits10));
 
-      if ((exp % static_cast<ExponentType>(cpp_dec_float_elem_digits10)) != static_cast<ExponentType>(0))
+      if((exp % static_cast<exponent_type>(cpp_dec_float_elem_digits10)) != static_cast<exponent_type>(0))
       {
-         n_shift = ((exp < static_cast<ExponentType>(0))
-                        ? static_cast<std::size_t>(n_exp_rem + static_cast<std::size_t>(cpp_dec_float_elem_digits10))
-                        : static_cast<std::size_t>(n_exp_rem));
+         n_shift = ((exp < static_cast<exponent_type>(0))
+                        ? static_cast<std::ptrdiff_t>(n_exp_rem + static_cast<std::ptrdiff_t>(cpp_dec_float_elem_digits10))
+                        : static_cast<std::ptrdiff_t>(n_exp_rem));
       }
 
       // Make sure that there are enough digits for the decimal point shift.
       pos = str.find(static_cast<char>('.'));
 
-      std::size_t pos_plus_one = static_cast<std::size_t>(pos + 1u);
+      std::ptrdiff_t pos_plus_one = static_cast<std::ptrdiff_t>(pos + 1);
 
-      if ((str.length() - pos_plus_one) < n_shift)
+      if ((static_cast<std::ptrdiff_t>(str.length()) - pos_plus_one) < n_shift)
       {
-         const std::size_t sz = static_cast<std::size_t>(n_shift - (str.length() - pos_plus_one));
+         const std::ptrdiff_t sz = static_cast<std::ptrdiff_t>(n_shift - (static_cast<std::ptrdiff_t>(str.length()) - pos_plus_one));
 
-         str.append(std::string(sz, static_cast<char>('0')));
+         str.append(std::string(static_cast<std::string::size_type>(sz), static_cast<char>('0')));
       }
 
       // Do the decimal point shift.
-      if (n_shift != static_cast<std::size_t>(0u))
+      if (n_shift != static_cast<std::ptrdiff_t>(0))
       {
          str.insert(static_cast<std::string::size_type>(pos_plus_one + n_shift), ".");
 
-         str.erase(pos, static_cast<std::string::size_type>(1u));
+         str.erase(pos, static_cast<std::ptrdiff_t>(1));
 
-         exp -= static_cast<ExponentType>(n_shift);
+         exp -= static_cast<exponent_type>(n_shift);
       }
 
       // Cut the size of the mantissa to <= cpp_dec_float_elem_digits10.
       pos          = str.find(static_cast<char>('.'));
-      pos_plus_one = static_cast<std::size_t>(pos + 1u);
+      pos_plus_one = static_cast<std::ptrdiff_t>(pos + 1u);
 
       if (pos > static_cast<std::size_t>(cpp_dec_float_elem_digits10))
       {
-         const boost::int32_t n_pos         = static_cast<boost::int32_t>(pos);
-         const boost::int32_t n_rem_is_zero = ((static_cast<boost::int32_t>(n_pos % cpp_dec_float_elem_digits10) == static_cast<boost::int32_t>(0)) ? static_cast<boost::int32_t>(1) : static_cast<boost::int32_t>(0));
-         const boost::int32_t n             = static_cast<boost::int32_t>(static_cast<boost::int32_t>(n_pos / cpp_dec_float_elem_digits10) - n_rem_is_zero);
+         const std::int32_t n_pos         = static_cast<std::int32_t>(pos);
+         const std::int32_t n_rem_is_zero = ((static_cast<std::int32_t>(n_pos % cpp_dec_float_elem_digits10) == static_cast<std::int32_t>(0)) ? static_cast<std::int32_t>(1) : static_cast<std::int32_t>(0));
+         const std::int32_t n             = static_cast<std::int32_t>(static_cast<std::int32_t>(n_pos / cpp_dec_float_elem_digits10) - n_rem_is_zero);
 
-         str.insert(static_cast<std::size_t>(static_cast<boost::int32_t>(n_pos - static_cast<boost::int32_t>(n * cpp_dec_float_elem_digits10))), ".");
+         str.insert(static_cast<std::size_t>(static_cast<std::int32_t>(n_pos - static_cast<std::int32_t>(n * cpp_dec_float_elem_digits10))), ".");
 
-         str.erase(pos_plus_one, static_cast<std::size_t>(1u));
+         str.erase(static_cast<std::size_t>(pos_plus_one), static_cast<std::size_t>(1u));
 
-         exp += static_cast<ExponentType>(static_cast<ExponentType>(n) * static_cast<ExponentType>(cpp_dec_float_elem_digits10));
+         exp += static_cast<exponent_type>(static_cast<exponent_type>(n) * static_cast<exponent_type>(cpp_dec_float_elem_digits10));
       }
 
       // Pad the decimal part such that its value is an even
       // multiple of cpp_dec_float_elem_digits10.
       pos          = str.find(static_cast<char>('.'));
-      pos_plus_one = static_cast<std::size_t>(pos + 1u);
+      pos_plus_one = static_cast<std::ptrdiff_t>(pos + 1u);
 
-      const boost::int32_t n_dec = static_cast<boost::int32_t>(static_cast<boost::int32_t>(str.length() - 1u) - static_cast<boost::int32_t>(pos));
-      const boost::int32_t n_rem = static_cast<boost::int32_t>(n_dec % cpp_dec_float_elem_digits10);
+      // Throws an error for a strange construction like 3.14L
+      if(pos != std::string::npos && (str.back() == 'L' || str.back() == 'l' || str.back() == 'u' || str.back() == 'U'))
+      {
+         BOOST_MP_THROW_EXCEPTION(std::runtime_error("Can not construct a floating point with an integer literal"));
+      }
 
-      boost::int32_t n_cnt = ((n_rem != static_cast<boost::int32_t>(0))
-                                  ? static_cast<boost::int32_t>(cpp_dec_float_elem_digits10 - n_rem)
-                                  : static_cast<boost::int32_t>(0));
+      const std::int32_t n_dec = static_cast<std::int32_t>(static_cast<std::int32_t>(str.length() - 1u) - static_cast<std::int32_t>(pos));
+      const std::int32_t n_rem = static_cast<std::int32_t>(n_dec % cpp_dec_float_elem_digits10);
 
-      if (n_cnt != static_cast<boost::int32_t>(0))
+      std::int32_t n_cnt = ((n_rem != static_cast<std::int32_t>(0))
+                                  ? static_cast<std::int32_t>(cpp_dec_float_elem_digits10 - n_rem)
+                                  : static_cast<std::int32_t>(0));
+
+      if (n_cnt != static_cast<std::int32_t>(0))
       {
          str.append(static_cast<std::size_t>(n_cnt), static_cast<char>('0'));
       }
@@ -2136,28 +2281,38 @@ bool cpp_dec_float<Digits10, ExponentType, Allocator>::rd_string(const char* con
       if (static_cast<std::size_t>(str.length() - pos) > max_dec)
       {
          str = str.substr(static_cast<std::size_t>(0u),
-                          static_cast<std::size_t>(pos_plus_one + max_dec));
+                          static_cast<std::size_t>(pos_plus_one + static_cast<std::ptrdiff_t>(max_dec)));
       }
 
       // Now the input string has the standard cpp_dec_float<Digits10, ExponentType, Allocator> input form.
       // (See the comment above.)
 
       // Set all the data elements to 0.
-      std::fill(data.begin(), data.end(), static_cast<boost::uint32_t>(0u));
+      std::fill(data.begin(), data.end(), static_cast<std::uint32_t>(0u));
 
       // Extract the data.
 
       // First get the digits to the left of the decimal point...
-      data[0u] = boost::lexical_cast<boost::uint32_t>(str.substr(static_cast<std::size_t>(0u), pos));
+      data[0u] = static_cast<std::uint32_t>(std::stol(str.substr(static_cast<std::size_t>(0u), pos)));
 
       // ...then get the remaining digits to the right of the decimal point.
-      const std::string::size_type i_end = ((str.length() - pos_plus_one) / static_cast<std::string::size_type>(cpp_dec_float_elem_digits10));
+      const std::string::size_type i_end =
+      (
+           static_cast<std::string::size_type>(str.length() - static_cast<std::string::size_type>(pos_plus_one))
+         / static_cast<std::string::size_type>(cpp_dec_float_elem_digits10)
+      );
 
       for (std::string::size_type i = static_cast<std::string::size_type>(0u); i < i_end; i++)
       {
-         const std::string::const_iterator it = str.begin() + pos_plus_one + (i * static_cast<std::string::size_type>(cpp_dec_float_elem_digits10));
-
-         data[i + 1u] = boost::lexical_cast<boost::uint32_t>(std::string(it, it + static_cast<std::string::size_type>(cpp_dec_float_elem_digits10)));
+         const std::string::const_iterator it =
+              str.begin()
+            + static_cast<std::ptrdiff_t>
+              (
+                   static_cast<std::string::size_type>(pos_plus_one)
+                 + static_cast<std::string::size_type>(i * static_cast<std::string::size_type>(cpp_dec_float_elem_digits10))
+              );
+
+         data[i + 1u] = static_cast<std::uint32_t>(std::stol(std::string(it, it + static_cast<std::string::size_type>(cpp_dec_float_elem_digits10))));
       }
 
       // Check for overflow...
@@ -2178,7 +2333,7 @@ bool cpp_dec_float<Digits10, ExponentType, Allocator>::rd_string(const char* con
             // Check for identity with the minimum value.
             cpp_dec_float<Digits10, ExponentType, Allocator> test = *this;
 
-            test.exp = static_cast<ExponentType>(0);
+            test.exp = static_cast<exponent_type>(0);
 
             if (test.isone())
             {
@@ -2193,7 +2348,11 @@ bool cpp_dec_float<Digits10, ExponentType, Allocator>::rd_string(const char* con
 
 #ifndef BOOST_NO_EXCEPTIONS
    }
+   #ifndef BOOST_MP_STANDALONE
    catch (const bad_lexical_cast&)
+   #else
+   catch (const std::exception&)
+   #endif
    {
       // Rethrow with better error message:
       std::string msg = "Unable to parse the string \"";
@@ -2220,14 +2379,14 @@ cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float(const double man
 
    if (mantissa_is_iszero)
    {
-      std::fill(data.begin(), data.end(), static_cast<boost::uint32_t>(0u));
+      std::fill(data.begin(), data.end(), static_cast<std::uint32_t>(0u));
       return;
    }
 
    const bool b_neg = (mantissa < 0.0);
 
    double       d = ((!b_neg) ? mantissa : -mantissa);
-   ExponentType e = exponent;
+   exponent_type e = exponent;
 
    while (d > 10.0)
    {
@@ -2240,9 +2399,9 @@ cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float(const double man
       --e;
    }
 
-   boost::int32_t shift = static_cast<boost::int32_t>(e % static_cast<boost::int32_t>(cpp_dec_float_elem_digits10));
+   std::int32_t shift = static_cast<std::int32_t>(e % static_cast<std::int32_t>(cpp_dec_float_elem_digits10));
 
-   while (static_cast<boost::int32_t>(shift-- % cpp_dec_float_elem_digits10) != static_cast<boost::int32_t>(0))
+   while (static_cast<std::int32_t>(shift-- % cpp_dec_float_elem_digits10) != static_cast<std::int32_t>(0))
    {
       d *= 10.0;
       --e;
@@ -2251,15 +2410,15 @@ cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float(const double man
    exp = e;
    neg = b_neg;
 
-   std::fill(data.begin(), data.end(), static_cast<boost::uint32_t>(0u));
+   std::fill(data.begin(), data.end(), static_cast<std::uint32_t>(0u));
 
-   static const boost::int32_t digit_ratio = static_cast<boost::int32_t>(static_cast<boost::int32_t>(std::numeric_limits<double>::digits10) / static_cast<boost::int32_t>(cpp_dec_float_elem_digits10));
-   static const boost::int32_t digit_loops = static_cast<boost::int32_t>(digit_ratio + static_cast<boost::int32_t>(2));
+   constexpr std::int32_t digit_ratio = static_cast<std::int32_t>(static_cast<std::int32_t>(std::numeric_limits<double>::digits10) / static_cast<std::int32_t>(cpp_dec_float_elem_digits10));
+   constexpr std::int32_t digit_loops = static_cast<std::int32_t>(digit_ratio + static_cast<std::int32_t>(2));
 
-   for (boost::int32_t i = static_cast<boost::int32_t>(0); i < digit_loops; i++)
+   for (std::int32_t i = static_cast<std::int32_t>(0); i < digit_loops; i++)
    {
-      boost::uint32_t n = static_cast<boost::uint32_t>(static_cast<boost::uint64_t>(d));
-      data[i]           = static_cast<boost::uint32_t>(n);
+      std::uint32_t n = static_cast<std::uint32_t>(static_cast<std::uint64_t>(d));
+      data[static_cast<std::size_t>(i)] = static_cast<std::uint32_t>(n);
       d -= static_cast<double>(n);
       d *= static_cast<double>(cpp_dec_float_elem_mask);
    }
@@ -2267,12 +2426,13 @@ cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float(const double man
 
 template <unsigned Digits10, class ExponentType, class Allocator>
 template <class Float>
-typename boost::enable_if_c<boost::is_floating_point<Float>::value, cpp_dec_float<Digits10, ExponentType, Allocator>&>::type cpp_dec_float<Digits10, ExponentType, Allocator>::operator=(Float a)
+typename std::enable_if<std::is_floating_point<Float>::value, cpp_dec_float<Digits10, ExponentType, Allocator>&>::type cpp_dec_float<Digits10, ExponentType, Allocator>::operator=(Float a)
 {
-   // Christopher Kormanyos's original code used a cast to boost::long_long_type here, but that fails
-   // when long double has more digits than a boost::long_long_type.
+   // Christopher Kormanyos's original code used a cast to long long here, but that fails
+   // when long double has more digits than a long long.
+   BOOST_MP_FLOAT128_USING
    using std::floor;
-   using std::frexp;
+   using std::frexp; 
    using std::ldexp;
 
    if (a == 0)
@@ -2281,7 +2441,7 @@ typename boost::enable_if_c<boost::is_floating_point<Float>::value, cpp_dec_floa
    if (a == 1)
       return *this = one();
 
-   if ((boost::math::isinf)(a))
+   if (BOOST_MP_ISINF(a))
    {
       *this = inf();
       if (a < 0)
@@ -2289,7 +2449,7 @@ typename boost::enable_if_c<boost::is_floating_point<Float>::value, cpp_dec_floa
       return *this;
    }
 
-   if ((boost::math::isnan)(a))
+   if (BOOST_MP_ISNAN(a))
       return *this = nan();
 
    int         e;
@@ -2298,15 +2458,15 @@ typename boost::enable_if_c<boost::is_floating_point<Float>::value, cpp_dec_floa
 
    f = frexp(a, &e);
    // See https://svn.boost.org/trac/boost/ticket/10924 for an example of why this may go wrong:
-   BOOST_ASSERT((boost::math::isfinite)(f));
+   BOOST_MP_ASSERT(!BOOST_MP_ISNAN(f) && !BOOST_MP_ISINF(f));
 
-   static const int shift = std::numeric_limits<int>::digits - 1;
+   constexpr const int shift = std::numeric_limits<int>::digits - 1;
 
    while (f)
    {
       // extract int sized bits from f:
       f = ldexp(f, shift);
-      BOOST_ASSERT((boost::math::isfinite)(f));
+      BOOST_MP_ASSERT(!BOOST_MP_ISNAN(f) && !BOOST_MP_ISINF(f));
       term = floor(f);
       e -= shift;
       *this *= pow2(shift);
@@ -2324,11 +2484,11 @@ typename boost::enable_if_c<boost::is_floating_point<Float>::value, cpp_dec_floa
 }
 
 template <unsigned Digits10, class ExponentType, class Allocator>
-void cpp_dec_float<Digits10, ExponentType, Allocator>::from_unsigned_long_long(const boost::ulong_long_type u)
+void cpp_dec_float<Digits10, ExponentType, Allocator>::from_unsigned_long_long(const unsigned long long u)
 {
-   std::fill(data.begin(), data.end(), static_cast<boost::uint32_t>(0u));
+   std::fill(data.begin(), data.end(), static_cast<std::uint32_t>(0u));
 
-   exp       = static_cast<ExponentType>(0);
+   exp       = static_cast<exponent_type>(0);
    neg       = false;
    fpclass   = cpp_dec_float_finite;
    prec_elem = cpp_dec_float_elem_number;
@@ -2340,20 +2500,20 @@ void cpp_dec_float<Digits10, ExponentType, Allocator>::from_unsigned_long_long(c
 
    std::size_t i = static_cast<std::size_t>(0u);
 
-   boost::ulong_long_type uu = u;
+   unsigned long long uu = u;
 
-   boost::uint32_t temp[(std::numeric_limits<boost::ulong_long_type>::digits10 / static_cast<int>(cpp_dec_float_elem_digits10)) + 3] = {static_cast<boost::uint32_t>(0u)};
+   std::uint32_t temp[(std::numeric_limits<unsigned long long>::digits10 / static_cast<int>(cpp_dec_float_elem_digits10)) + 3] = {static_cast<std::uint32_t>(0u)};
 
-   while (uu != static_cast<boost::ulong_long_type>(0u))
+   while (uu != static_cast<unsigned long long>(0u))
    {
-      temp[i] = static_cast<boost::uint32_t>(uu % static_cast<boost::ulong_long_type>(cpp_dec_float_elem_mask));
-      uu      = static_cast<boost::ulong_long_type>(uu / static_cast<boost::ulong_long_type>(cpp_dec_float_elem_mask));
+      temp[i] = static_cast<std::uint32_t>(uu % static_cast<unsigned long long>(cpp_dec_float_elem_mask));
+      uu      = static_cast<unsigned long long>(uu / static_cast<unsigned long long>(cpp_dec_float_elem_mask));
       ++i;
    }
 
    if (i > static_cast<std::size_t>(1u))
    {
-      exp += static_cast<ExponentType>((i - 1u) * static_cast<std::size_t>(cpp_dec_float_elem_digits10));
+      exp += static_cast<exponent_type>((i - 1u) * static_cast<std::size_t>(cpp_dec_float_elem_digits10));
    }
 
    std::reverse(temp, temp + i);
@@ -2361,349 +2521,612 @@ void cpp_dec_float<Digits10, ExponentType, Allocator>::from_unsigned_long_long(c
 }
 
 template <unsigned Digits10, class ExponentType, class Allocator>
-boost::uint32_t cpp_dec_float<Digits10, ExponentType, Allocator>::mul_loop_uv(boost::uint32_t* const u, const boost::uint32_t* const v, const boost::int32_t p)
+template <typename InputIteratorTypeLeft, typename InputIteratorTypeRight>
+int cpp_dec_float<Digits10, ExponentType, Allocator>::compare_ranges(InputIteratorTypeLeft  a,
+                                                                     InputIteratorTypeRight b,
+                                                                     const std::uint32_t    count)
 {
-   //
-   // There is a limit on how many limbs this algorithm can handle without dropping digits
-   // due to overflow in the carry, it is:
-   //
-   // FLOOR( (2^64 - 1) / (10^8 * 10^8) ) == 1844
-   //
-   BOOST_STATIC_ASSERT_MSG(cpp_dec_float_elem_number < 1800, "Too many limbs in the data type for the multiplication algorithm - unsupported precision in cpp_dec_float.");
+   using local_iterator_left_type  = InputIteratorTypeLeft;
+   using local_iterator_right_type = InputIteratorTypeRight;
+
+   local_iterator_left_type  begin_a(a);
+   local_iterator_left_type  end_a  (a + count);
+   local_iterator_right_type begin_b(b);
+   local_iterator_right_type end_b  (b + count);
+
+   const auto mismatch_pair = std::mismatch(begin_a, end_a, begin_b);
+
+   int n_return;
+
+   if((mismatch_pair.first != end_a) || (mismatch_pair.second != end_b))
+   {
+      const typename std::iterator_traits<InputIteratorTypeLeft>::value_type  left  = *mismatch_pair.first;
+      const typename std::iterator_traits<InputIteratorTypeRight>::value_type right = *mismatch_pair.second;
+
+      n_return = ((left > right) ?  1 : -1);
+   }
+   else
+   {
+      n_return = 0;
+   }
+
+   return n_return;
+}
+
+template <unsigned Digits10, class ExponentType, class Allocator>
+std::uint32_t cpp_dec_float<Digits10, ExponentType, Allocator>::eval_add_n(      std::uint32_t* r,
+                                                                           const std::uint32_t* u,
+                                                                           const std::uint32_t* v,
+                                                                           const std::int32_t   count)
+{
+   // Addition algorithm
+   std::uint_fast8_t carry = static_cast<std::uint_fast8_t>(0U);
+
+   for(std::int32_t j = static_cast<std::int32_t>(count - static_cast<std::int32_t>(1)); j >= static_cast<std::int32_t>(0); --j)
+   {
+      const std::uint32_t t = static_cast<std::uint32_t>(static_cast<std::uint32_t>(u[j] + v[j]) + carry);
+
+      carry = ((t >= static_cast<std::uint32_t>(cpp_dec_float_elem_mask)) ? static_cast<std::uint_fast8_t>(1U)
+                                                                   : static_cast<std::uint_fast8_t>(0U));
+
+      r[j]  = static_cast<std::uint32_t>(t - ((carry != 0U) ? static_cast<std::uint32_t>(cpp_dec_float_elem_mask)
+                                                            : static_cast<std::uint32_t>(0U)));
+   }
+
+   return static_cast<std::uint32_t>(carry);
+}
+
+template <unsigned Digits10, class ExponentType, class Allocator>
+std::uint32_t cpp_dec_float<Digits10, ExponentType, Allocator>::eval_subtract_n(      std::uint32_t* r,
+                                                                                const std::uint32_t* u,
+                                                                                const std::uint32_t* v,
+                                                                                const std::int32_t   count)
+{
+   // Subtraction algorithm
+   std::int_fast8_t borrow = static_cast<std::int_fast8_t>(0);
+
+   for(std::uint32_t j = static_cast<std::uint32_t>(count - static_cast<std::int32_t>(1)); static_cast<std::int32_t>(j) >= static_cast<std::int32_t>(0); --j)
+   {
+      std::int32_t t = static_cast<std::int32_t>(  static_cast<std::int32_t>(u[j])
+                                                 - static_cast<std::int32_t>(v[j])) - borrow;
+
+      // Underflow? Borrow?
+      if(t < 0)
+      {
+         // Yes, underflow and borrow
+         t     += static_cast<std::int32_t>(cpp_dec_float_elem_mask);
+         borrow = static_cast<std::int_fast8_t>(1);
+      }
+      else
+      {
+         borrow = static_cast<std::int_fast8_t>(0);
+      }
+
+      r[j] = static_cast<std::uint32_t>(t);
+   }
 
-   boost::uint64_t carry = static_cast<boost::uint64_t>(0u);
+   return static_cast<std::uint32_t>(borrow);
+}
+
+template <unsigned Digits10, class ExponentType, class Allocator>
+void cpp_dec_float<Digits10, ExponentType, Allocator>::eval_multiply_n_by_n_to_2n(      std::uint32_t* r,
+                                                                                  const std::uint32_t* a,
+                                                                                  const std::uint32_t* b,
+                                                                                  const std::uint32_t  count)
+{
+   using local_limb_type = std::uint32_t;
+
+   using local_double_limb_type = std::uint64_t;
+
+   using local_reverse_iterator_type = std::reverse_iterator<local_limb_type*>;
+
+   local_reverse_iterator_type ir(r + (count * 2));
 
-   for (boost::int32_t j = static_cast<boost::int32_t>(p - 1u); j >= static_cast<boost::int32_t>(0); j--)
+   local_double_limb_type carry = 0U;
+
+   for(std::int32_t j = static_cast<std::int32_t>(count - 1); j >= static_cast<std::int32_t>(1); --j)
    {
-      boost::uint64_t sum = carry;
+      local_double_limb_type sum = carry;
 
-      for (boost::int32_t i = j; i >= static_cast<boost::int32_t>(0); i--)
+      for(std::int32_t i = static_cast<std::int32_t>(count - 1); i >= j; --i)
       {
-         sum += static_cast<boost::uint64_t>(u[j - i] * static_cast<boost::uint64_t>(v[i]));
+         sum += local_double_limb_type(
+                local_double_limb_type(a[i]) * b[  static_cast<std::int32_t>(count - 1)
+                                                - static_cast<std::int32_t>(i - j)]);
       }
 
-      u[j]  = static_cast<boost::uint32_t>(sum % static_cast<boost::uint32_t>(cpp_dec_float_elem_mask));
-      carry = static_cast<boost::uint64_t>(sum / static_cast<boost::uint32_t>(cpp_dec_float_elem_mask));
+      carry = static_cast<local_double_limb_type>(sum / static_cast<local_limb_type>       (cpp_dec_float_elem_mask));
+      *ir++ = static_cast<local_limb_type>       (sum - static_cast<local_double_limb_type>(static_cast<local_double_limb_type>(carry) * static_cast<local_limb_type>(cpp_dec_float_elem_mask)));
    }
 
-   return static_cast<boost::uint32_t>(carry);
+   for(std::int32_t j = static_cast<std::int32_t>(count - 1); j >= static_cast<std::int32_t>(0); --j)
+   {
+      local_double_limb_type sum = carry;
+
+      for(std::int32_t i = j; i >= static_cast<std::int32_t>(0); --i)
+      {
+         sum += static_cast<local_double_limb_type>(a[j - i] * static_cast<local_double_limb_type>(b[i]));
+      }
+
+      carry = static_cast<local_double_limb_type>(sum / static_cast<local_limb_type>(cpp_dec_float_elem_mask));
+      *ir++ = static_cast<local_limb_type>       (sum - static_cast<local_double_limb_type>(static_cast<local_double_limb_type>(carry) * static_cast<local_limb_type>(cpp_dec_float_elem_mask)));
+   }
+
+   *ir = static_cast<local_limb_type>(carry);
 }
 
 template <unsigned Digits10, class ExponentType, class Allocator>
-boost::uint32_t cpp_dec_float<Digits10, ExponentType, Allocator>::mul_loop_n(boost::uint32_t* const u, boost::uint32_t n, const boost::int32_t p)
+std::uint32_t cpp_dec_float<Digits10, ExponentType, Allocator>::mul_loop_n(std::uint32_t* const u, std::uint32_t n, const std::int32_t p)
 {
-   boost::uint64_t carry = static_cast<boost::uint64_t>(0u);
+   std::uint64_t carry = static_cast<std::uint64_t>(0u);
 
    // Multiplication loop.
-   for (boost::int32_t j = p - 1; j >= static_cast<boost::int32_t>(0); j--)
-   {
-      const boost::uint64_t t = static_cast<boost::uint64_t>(carry + static_cast<boost::uint64_t>(u[j] * static_cast<boost::uint64_t>(n)));
-      carry                   = static_cast<boost::uint64_t>(t / static_cast<boost::uint32_t>(cpp_dec_float_elem_mask));
-      u[j]                    = static_cast<boost::uint32_t>(t - static_cast<boost::uint64_t>(static_cast<boost::uint32_t>(cpp_dec_float_elem_mask) * static_cast<boost::uint64_t>(carry)));
-   }
-
-   return static_cast<boost::uint32_t>(carry);
-}
-
-template <unsigned Digits10, class ExponentType, class Allocator>
-boost::uint32_t cpp_dec_float<Digits10, ExponentType, Allocator>::div_loop_n(boost::uint32_t* const u, boost::uint32_t n, const boost::int32_t p)
-{
-   boost::uint64_t prev = static_cast<boost::uint64_t>(0u);
-
-   for (boost::int32_t j = static_cast<boost::int32_t>(0); j < p; j++)
-   {
-      const boost::uint64_t t = static_cast<boost::uint64_t>(u[j] + static_cast<boost::uint64_t>(prev * static_cast<boost::uint32_t>(cpp_dec_float_elem_mask)));
-      u[j]                    = static_cast<boost::uint32_t>(t / n);
-      prev                    = static_cast<boost::uint64_t>(t - static_cast<boost::uint64_t>(n * static_cast<boost::uint64_t>(u[j])));
-   }
-
-   return static_cast<boost::uint32_t>(prev);
-}
-
-template <unsigned Digits10, class ExponentType, class Allocator>
-cpp_dec_float<Digits10, ExponentType, Allocator> cpp_dec_float<Digits10, ExponentType, Allocator>::pow2(const boost::long_long_type p)
-{
-   // Create a static const table of p^2 for -128 < p < +128.
-   // Note: The size of this table must be odd-numbered and
-   // symmetric about 0.
-   init.do_nothing();
-   static const boost::array<cpp_dec_float<Digits10, ExponentType, Allocator>, 255u> p2_data =
-       {{cpp_dec_float("5.877471754111437539843682686111228389093327783860437607543758531392086297273635864257812500000000000e-39"),
-         cpp_dec_float("1.175494350822287507968736537222245677818665556772087521508751706278417259454727172851562500000000000e-38"),
-         cpp_dec_float("2.350988701644575015937473074444491355637331113544175043017503412556834518909454345703125000000000000e-38"),
-         cpp_dec_float("4.701977403289150031874946148888982711274662227088350086035006825113669037818908691406250000000000000e-38"),
-         cpp_dec_float("9.403954806578300063749892297777965422549324454176700172070013650227338075637817382812500000000000000e-38"),
-         cpp_dec_float("1.880790961315660012749978459555593084509864890835340034414002730045467615127563476562500000000000000e-37"),
-         cpp_dec_float("3.761581922631320025499956919111186169019729781670680068828005460090935230255126953125000000000000000e-37"),
-         cpp_dec_float("7.523163845262640050999913838222372338039459563341360137656010920181870460510253906250000000000000000e-37"),
-         cpp_dec_float("1.504632769052528010199982767644474467607891912668272027531202184036374092102050781250000000000000000e-36"),
-         cpp_dec_float("3.009265538105056020399965535288948935215783825336544055062404368072748184204101562500000000000000000e-36"),
-         cpp_dec_float("6.018531076210112040799931070577897870431567650673088110124808736145496368408203125000000000000000000e-36"),
-         cpp_dec_float("1.203706215242022408159986214115579574086313530134617622024961747229099273681640625000000000000000000e-35"),
-         cpp_dec_float("2.407412430484044816319972428231159148172627060269235244049923494458198547363281250000000000000000000e-35"),
-         cpp_dec_float("4.814824860968089632639944856462318296345254120538470488099846988916397094726562500000000000000000000e-35"),
-         cpp_dec_float("9.629649721936179265279889712924636592690508241076940976199693977832794189453125000000000000000000000e-35"),
-         cpp_dec_float("1.925929944387235853055977942584927318538101648215388195239938795566558837890625000000000000000000000e-34"),
-         cpp_dec_float("3.851859888774471706111955885169854637076203296430776390479877591133117675781250000000000000000000000e-34"),
-         cpp_dec_float("7.703719777548943412223911770339709274152406592861552780959755182266235351562500000000000000000000000e-34"),
-         cpp_dec_float("1.540743955509788682444782354067941854830481318572310556191951036453247070312500000000000000000000000e-33"),
-         cpp_dec_float("3.081487911019577364889564708135883709660962637144621112383902072906494140625000000000000000000000000e-33"),
-         cpp_dec_float("6.162975822039154729779129416271767419321925274289242224767804145812988281250000000000000000000000000e-33"),
-         cpp_dec_float("1.232595164407830945955825883254353483864385054857848444953560829162597656250000000000000000000000000e-32"),
-         cpp_dec_float("2.465190328815661891911651766508706967728770109715696889907121658325195312500000000000000000000000000e-32"),
-         cpp_dec_float("4.930380657631323783823303533017413935457540219431393779814243316650390625000000000000000000000000000e-32"),
-         cpp_dec_float("9.860761315262647567646607066034827870915080438862787559628486633300781250000000000000000000000000000e-32"),
-         cpp_dec_float("1.972152263052529513529321413206965574183016087772557511925697326660156250000000000000000000000000000e-31"),
-         cpp_dec_float("3.944304526105059027058642826413931148366032175545115023851394653320312500000000000000000000000000000e-31"),
-         cpp_dec_float("7.888609052210118054117285652827862296732064351090230047702789306640625000000000000000000000000000000e-31"),
-         cpp_dec_float("1.577721810442023610823457130565572459346412870218046009540557861328125000000000000000000000000000000e-30"),
-         cpp_dec_float("3.155443620884047221646914261131144918692825740436092019081115722656250000000000000000000000000000000e-30"),
-         cpp_dec_float("6.310887241768094443293828522262289837385651480872184038162231445312500000000000000000000000000000000e-30"),
-         cpp_dec_float("1.262177448353618888658765704452457967477130296174436807632446289062500000000000000000000000000000000e-29"),
-         cpp_dec_float("2.524354896707237777317531408904915934954260592348873615264892578125000000000000000000000000000000000e-29"),
-         cpp_dec_float("5.048709793414475554635062817809831869908521184697747230529785156250000000000000000000000000000000000e-29"),
-         cpp_dec_float("1.009741958682895110927012563561966373981704236939549446105957031250000000000000000000000000000000000e-28"),
-         cpp_dec_float("2.019483917365790221854025127123932747963408473879098892211914062500000000000000000000000000000000000e-28"),
-         cpp_dec_float("4.038967834731580443708050254247865495926816947758197784423828125000000000000000000000000000000000000e-28"),
-         cpp_dec_float("8.077935669463160887416100508495730991853633895516395568847656250000000000000000000000000000000000000e-28"),
-         cpp_dec_float("1.615587133892632177483220101699146198370726779103279113769531250000000000000000000000000000000000000e-27"),
-         cpp_dec_float("3.231174267785264354966440203398292396741453558206558227539062500000000000000000000000000000000000000e-27"),
-         cpp_dec_float("6.462348535570528709932880406796584793482907116413116455078125000000000000000000000000000000000000000e-27"),
-         cpp_dec_float("1.292469707114105741986576081359316958696581423282623291015625000000000000000000000000000000000000000e-26"),
-         cpp_dec_float("2.584939414228211483973152162718633917393162846565246582031250000000000000000000000000000000000000000e-26"),
-         cpp_dec_float("5.169878828456422967946304325437267834786325693130493164062500000000000000000000000000000000000000000e-26"),
-         cpp_dec_float("1.033975765691284593589260865087453566957265138626098632812500000000000000000000000000000000000000000e-25"),
-         cpp_dec_float("2.067951531382569187178521730174907133914530277252197265625000000000000000000000000000000000000000000e-25"),
-         cpp_dec_float("4.135903062765138374357043460349814267829060554504394531250000000000000000000000000000000000000000000e-25"),
-         cpp_dec_float("8.271806125530276748714086920699628535658121109008789062500000000000000000000000000000000000000000000e-25"),
-         cpp_dec_float("1.654361225106055349742817384139925707131624221801757812500000000000000000000000000000000000000000000e-24"),
-         cpp_dec_float("3.308722450212110699485634768279851414263248443603515625000000000000000000000000000000000000000000000e-24"),
-         cpp_dec_float("6.617444900424221398971269536559702828526496887207031250000000000000000000000000000000000000000000000e-24"),
-         cpp_dec_float("1.323488980084844279794253907311940565705299377441406250000000000000000000000000000000000000000000000e-23"),
-         cpp_dec_float("2.646977960169688559588507814623881131410598754882812500000000000000000000000000000000000000000000000e-23"),
-         cpp_dec_float("5.293955920339377119177015629247762262821197509765625000000000000000000000000000000000000000000000000e-23"),
-         cpp_dec_float("1.058791184067875423835403125849552452564239501953125000000000000000000000000000000000000000000000000e-22"),
-         cpp_dec_float("2.117582368135750847670806251699104905128479003906250000000000000000000000000000000000000000000000000e-22"),
-         cpp_dec_float("4.235164736271501695341612503398209810256958007812500000000000000000000000000000000000000000000000000e-22"),
-         cpp_dec_float("8.470329472543003390683225006796419620513916015625000000000000000000000000000000000000000000000000000e-22"),
-         cpp_dec_float("1.694065894508600678136645001359283924102783203125000000000000000000000000000000000000000000000000000e-21"),
-         cpp_dec_float("3.388131789017201356273290002718567848205566406250000000000000000000000000000000000000000000000000000e-21"),
-         cpp_dec_float("6.776263578034402712546580005437135696411132812500000000000000000000000000000000000000000000000000000e-21"),
-         cpp_dec_float("1.355252715606880542509316001087427139282226562500000000000000000000000000000000000000000000000000000e-20"),
-         cpp_dec_float("2.710505431213761085018632002174854278564453125000000000000000000000000000000000000000000000000000000e-20"),
-         cpp_dec_float("5.421010862427522170037264004349708557128906250000000000000000000000000000000000000000000000000000000e-20"),
-         cpp_dec_float("1.084202172485504434007452800869941711425781250000000000000000000000000000000000000000000000000000000e-19"),
-         cpp_dec_float("2.168404344971008868014905601739883422851562500000000000000000000000000000000000000000000000000000000e-19"),
-         cpp_dec_float("4.336808689942017736029811203479766845703125000000000000000000000000000000000000000000000000000000000e-19"),
-         cpp_dec_float("8.673617379884035472059622406959533691406250000000000000000000000000000000000000000000000000000000000e-19"),
-         cpp_dec_float("1.734723475976807094411924481391906738281250000000000000000000000000000000000000000000000000000000000e-18"),
-         cpp_dec_float("3.469446951953614188823848962783813476562500000000000000000000000000000000000000000000000000000000000e-18"),
-         cpp_dec_float("6.938893903907228377647697925567626953125000000000000000000000000000000000000000000000000000000000000e-18"),
-         cpp_dec_float("1.387778780781445675529539585113525390625000000000000000000000000000000000000000000000000000000000000e-17"),
-         cpp_dec_float("2.775557561562891351059079170227050781250000000000000000000000000000000000000000000000000000000000000e-17"),
-         cpp_dec_float("5.551115123125782702118158340454101562500000000000000000000000000000000000000000000000000000000000000e-17"),
-         cpp_dec_float("1.110223024625156540423631668090820312500000000000000000000000000000000000000000000000000000000000000e-16"),
-         cpp_dec_float("2.220446049250313080847263336181640625000000000000000000000000000000000000000000000000000000000000000e-16"),
-         cpp_dec_float("4.440892098500626161694526672363281250000000000000000000000000000000000000000000000000000000000000000e-16"),
-         cpp_dec_float("8.881784197001252323389053344726562500000000000000000000000000000000000000000000000000000000000000000e-16"),
-         cpp_dec_float("1.776356839400250464677810668945312500000000000000000000000000000000000000000000000000000000000000000e-15"),
-         cpp_dec_float("3.552713678800500929355621337890625000000000000000000000000000000000000000000000000000000000000000000e-15"),
-         cpp_dec_float("7.105427357601001858711242675781250000000000000000000000000000000000000000000000000000000000000000000e-15"),
-         cpp_dec_float("1.421085471520200371742248535156250000000000000000000000000000000000000000000000000000000000000000000e-14"),
-         cpp_dec_float("2.842170943040400743484497070312500000000000000000000000000000000000000000000000000000000000000000000e-14"),
-         cpp_dec_float("5.684341886080801486968994140625000000000000000000000000000000000000000000000000000000000000000000000e-14"),
-         cpp_dec_float("1.136868377216160297393798828125000000000000000000000000000000000000000000000000000000000000000000000e-13"),
-         cpp_dec_float("2.273736754432320594787597656250000000000000000000000000000000000000000000000000000000000000000000000e-13"),
-         cpp_dec_float("4.547473508864641189575195312500000000000000000000000000000000000000000000000000000000000000000000000e-13"),
-         cpp_dec_float("9.094947017729282379150390625000000000000000000000000000000000000000000000000000000000000000000000000e-13"),
-         cpp_dec_float("1.818989403545856475830078125000000000000000000000000000000000000000000000000000000000000000000000000e-12"),
-         cpp_dec_float("3.637978807091712951660156250000000000000000000000000000000000000000000000000000000000000000000000000e-12"),
-         cpp_dec_float("7.275957614183425903320312500000000000000000000000000000000000000000000000000000000000000000000000000e-12"),
-         cpp_dec_float("1.455191522836685180664062500000000000000000000000000000000000000000000000000000000000000000000000000e-11"),
-         cpp_dec_float("2.910383045673370361328125000000000000000000000000000000000000000000000000000000000000000000000000000e-11"),
-         cpp_dec_float("5.820766091346740722656250000000000000000000000000000000000000000000000000000000000000000000000000000e-11"),
-         cpp_dec_float("1.164153218269348144531250000000000000000000000000000000000000000000000000000000000000000000000000000e-10"),
-         cpp_dec_float("2.328306436538696289062500000000000000000000000000000000000000000000000000000000000000000000000000000e-10"),
-         cpp_dec_float("4.656612873077392578125000000000000000000000000000000000000000000000000000000000000000000000000000000e-10"),
-         cpp_dec_float("9.313225746154785156250000000000000000000000000000000000000000000000000000000000000000000000000000000e-10"),
-         cpp_dec_float("1.862645149230957031250000000000000000000000000000000000000000000000000000000000000000000000000000000e-9"),
-         cpp_dec_float("3.725290298461914062500000000000000000000000000000000000000000000000000000000000000000000000000000000e-9"),
-         cpp_dec_float("7.450580596923828125000000000000000000000000000000000000000000000000000000000000000000000000000000000e-9"),
-         cpp_dec_float("1.490116119384765625000000000000000000000000000000000000000000000000000000000000000000000000000000000e-8"),
-         cpp_dec_float("2.980232238769531250000000000000000000000000000000000000000000000000000000000000000000000000000000000e-8"),
-         cpp_dec_float("5.960464477539062500000000000000000000000000000000000000000000000000000000000000000000000000000000000e-8"),
-         cpp_dec_float("1.192092895507812500000000000000000000000000000000000000000000000000000000000000000000000000000000000e-7"),
-         cpp_dec_float("2.384185791015625000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-7"),
-         cpp_dec_float("4.768371582031250000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-7"),
-         cpp_dec_float("9.536743164062500000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-7"),
-         cpp_dec_float("1.907348632812500000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-6"),
-         cpp_dec_float("3.814697265625000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-6"),
-         cpp_dec_float("7.629394531250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-6"),
-         cpp_dec_float("0.000015258789062500000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
-         cpp_dec_float("0.000030517578125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
-         cpp_dec_float("0.000061035156250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
-         cpp_dec_float("0.000122070312500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
-         cpp_dec_float("0.000244140625000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
-         cpp_dec_float("0.000488281250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
-         cpp_dec_float("0.000976562500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
-         cpp_dec_float("0.001953125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
-         cpp_dec_float("0.003906250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
-         cpp_dec_float("0.007812500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
-         cpp_dec_float("0.01562500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
-         cpp_dec_float("0.03125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
-         cpp_dec_float("0.06250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
-         cpp_dec_float("0.125"),
-         cpp_dec_float("0.25"),
-         cpp_dec_float("0.5"),
-         one(),
-         two(),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(4)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(8)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(16)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(32)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(64)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(128)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(256)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(512)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(1024)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(2048)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(4096)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(8192)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(16384)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(32768)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(65536)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(131072)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(262144)),
-         cpp_dec_float(static_cast<boost::ulong_long_type>(524288)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uL << 20u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uL << 21u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uL << 22u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uL << 23u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uL << 24u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uL << 25u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uL << 26u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uL << 27u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uL << 28u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uL << 29u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uL << 30u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uL << 31u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 32u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 33u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 34u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 35u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 36u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 37u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 38u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 39u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 40u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 41u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 42u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 43u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 44u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 45u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 46u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 47u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 48u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 49u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 50u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 51u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 52u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 53u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 54u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 55u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 56u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 57u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 58u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 59u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 60u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 61u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 62u)),
-         cpp_dec_float(static_cast<boost::uint64_t>(1uLL << 63u)),
-         cpp_dec_float("1.844674407370955161600000000000000000000000000000000000000000000000000000000000000000000000000000000e19"),
-         cpp_dec_float("3.689348814741910323200000000000000000000000000000000000000000000000000000000000000000000000000000000e19"),
-         cpp_dec_float("7.378697629483820646400000000000000000000000000000000000000000000000000000000000000000000000000000000e19"),
-         cpp_dec_float("1.475739525896764129280000000000000000000000000000000000000000000000000000000000000000000000000000000e20"),
-         cpp_dec_float("2.951479051793528258560000000000000000000000000000000000000000000000000000000000000000000000000000000e20"),
-         cpp_dec_float("5.902958103587056517120000000000000000000000000000000000000000000000000000000000000000000000000000000e20"),
-         cpp_dec_float("1.180591620717411303424000000000000000000000000000000000000000000000000000000000000000000000000000000e21"),
-         cpp_dec_float("2.361183241434822606848000000000000000000000000000000000000000000000000000000000000000000000000000000e21"),
-         cpp_dec_float("4.722366482869645213696000000000000000000000000000000000000000000000000000000000000000000000000000000e21"),
-         cpp_dec_float("9.444732965739290427392000000000000000000000000000000000000000000000000000000000000000000000000000000e21"),
-         cpp_dec_float("1.888946593147858085478400000000000000000000000000000000000000000000000000000000000000000000000000000e22"),
-         cpp_dec_float("3.777893186295716170956800000000000000000000000000000000000000000000000000000000000000000000000000000e22"),
-         cpp_dec_float("7.555786372591432341913600000000000000000000000000000000000000000000000000000000000000000000000000000e22"),
-         cpp_dec_float("1.511157274518286468382720000000000000000000000000000000000000000000000000000000000000000000000000000e23"),
-         cpp_dec_float("3.022314549036572936765440000000000000000000000000000000000000000000000000000000000000000000000000000e23"),
-         cpp_dec_float("6.044629098073145873530880000000000000000000000000000000000000000000000000000000000000000000000000000e23"),
-         cpp_dec_float("1.208925819614629174706176000000000000000000000000000000000000000000000000000000000000000000000000000e24"),
-         cpp_dec_float("2.417851639229258349412352000000000000000000000000000000000000000000000000000000000000000000000000000e24"),
-         cpp_dec_float("4.835703278458516698824704000000000000000000000000000000000000000000000000000000000000000000000000000e24"),
-         cpp_dec_float("9.671406556917033397649408000000000000000000000000000000000000000000000000000000000000000000000000000e24"),
-         cpp_dec_float("1.934281311383406679529881600000000000000000000000000000000000000000000000000000000000000000000000000e25"),
-         cpp_dec_float("3.868562622766813359059763200000000000000000000000000000000000000000000000000000000000000000000000000e25"),
-         cpp_dec_float("7.737125245533626718119526400000000000000000000000000000000000000000000000000000000000000000000000000e25"),
-         cpp_dec_float("1.547425049106725343623905280000000000000000000000000000000000000000000000000000000000000000000000000e26"),
-         cpp_dec_float("3.094850098213450687247810560000000000000000000000000000000000000000000000000000000000000000000000000e26"),
-         cpp_dec_float("6.189700196426901374495621120000000000000000000000000000000000000000000000000000000000000000000000000e26"),
-         cpp_dec_float("1.237940039285380274899124224000000000000000000000000000000000000000000000000000000000000000000000000e27"),
-         cpp_dec_float("2.475880078570760549798248448000000000000000000000000000000000000000000000000000000000000000000000000e27"),
-         cpp_dec_float("4.951760157141521099596496896000000000000000000000000000000000000000000000000000000000000000000000000e27"),
-         cpp_dec_float("9.903520314283042199192993792000000000000000000000000000000000000000000000000000000000000000000000000e27"),
-         cpp_dec_float("1.980704062856608439838598758400000000000000000000000000000000000000000000000000000000000000000000000e28"),
-         cpp_dec_float("3.961408125713216879677197516800000000000000000000000000000000000000000000000000000000000000000000000e28"),
-         cpp_dec_float("7.922816251426433759354395033600000000000000000000000000000000000000000000000000000000000000000000000e28"),
-         cpp_dec_float("1.584563250285286751870879006720000000000000000000000000000000000000000000000000000000000000000000000e29"),
-         cpp_dec_float("3.169126500570573503741758013440000000000000000000000000000000000000000000000000000000000000000000000e29"),
-         cpp_dec_float("6.338253001141147007483516026880000000000000000000000000000000000000000000000000000000000000000000000e29"),
-         cpp_dec_float("1.267650600228229401496703205376000000000000000000000000000000000000000000000000000000000000000000000e30"),
-         cpp_dec_float("2.535301200456458802993406410752000000000000000000000000000000000000000000000000000000000000000000000e30"),
-         cpp_dec_float("5.070602400912917605986812821504000000000000000000000000000000000000000000000000000000000000000000000e30"),
-         cpp_dec_float("1.014120480182583521197362564300800000000000000000000000000000000000000000000000000000000000000000000e31"),
-         cpp_dec_float("2.028240960365167042394725128601600000000000000000000000000000000000000000000000000000000000000000000e31"),
-         cpp_dec_float("4.056481920730334084789450257203200000000000000000000000000000000000000000000000000000000000000000000e31"),
-         cpp_dec_float("8.112963841460668169578900514406400000000000000000000000000000000000000000000000000000000000000000000e31"),
-         cpp_dec_float("1.622592768292133633915780102881280000000000000000000000000000000000000000000000000000000000000000000e32"),
-         cpp_dec_float("3.245185536584267267831560205762560000000000000000000000000000000000000000000000000000000000000000000e32"),
-         cpp_dec_float("6.490371073168534535663120411525120000000000000000000000000000000000000000000000000000000000000000000e32"),
-         cpp_dec_float("1.298074214633706907132624082305024000000000000000000000000000000000000000000000000000000000000000000e33"),
-         cpp_dec_float("2.596148429267413814265248164610048000000000000000000000000000000000000000000000000000000000000000000e33"),
-         cpp_dec_float("5.192296858534827628530496329220096000000000000000000000000000000000000000000000000000000000000000000e33"),
-         cpp_dec_float("1.038459371706965525706099265844019200000000000000000000000000000000000000000000000000000000000000000e34"),
-         cpp_dec_float("2.076918743413931051412198531688038400000000000000000000000000000000000000000000000000000000000000000e34"),
-         cpp_dec_float("4.153837486827862102824397063376076800000000000000000000000000000000000000000000000000000000000000000e34"),
-         cpp_dec_float("8.307674973655724205648794126752153600000000000000000000000000000000000000000000000000000000000000000e34"),
-         cpp_dec_float("1.661534994731144841129758825350430720000000000000000000000000000000000000000000000000000000000000000e35"),
-         cpp_dec_float("3.323069989462289682259517650700861440000000000000000000000000000000000000000000000000000000000000000e35"),
-         cpp_dec_float("6.646139978924579364519035301401722880000000000000000000000000000000000000000000000000000000000000000e35"),
-         cpp_dec_float("1.329227995784915872903807060280344576000000000000000000000000000000000000000000000000000000000000000e36"),
-         cpp_dec_float("2.658455991569831745807614120560689152000000000000000000000000000000000000000000000000000000000000000e36"),
-         cpp_dec_float("5.316911983139663491615228241121378304000000000000000000000000000000000000000000000000000000000000000e36"),
-         cpp_dec_float("1.063382396627932698323045648224275660800000000000000000000000000000000000000000000000000000000000000e37"),
-         cpp_dec_float("2.126764793255865396646091296448551321600000000000000000000000000000000000000000000000000000000000000e37"),
-         cpp_dec_float("4.253529586511730793292182592897102643200000000000000000000000000000000000000000000000000000000000000e37"),
-         cpp_dec_float("8.507059173023461586584365185794205286400000000000000000000000000000000000000000000000000000000000000e37"),
-         cpp_dec_float("1.701411834604692317316873037158841057280000000000000000000000000000000000000000000000000000000000000e38")}};
-
-   if ((p > static_cast<boost::long_long_type>(-128)) && (p < static_cast<boost::long_long_type>(+128)))
-   {
-      return p2_data[static_cast<std::size_t>(p + ((p2_data.size() - 1u) / 2u))];
+   for (std::int32_t j = p - 1; j >= static_cast<std::int32_t>(0); j--)
+   {
+      const std::uint64_t t = static_cast<std::uint64_t>(carry + static_cast<std::uint64_t>(u[j] * static_cast<std::uint64_t>(n)));
+      carry                 = static_cast<std::uint64_t>(t / static_cast<std::uint32_t>(cpp_dec_float_elem_mask));
+      u[j]                  = static_cast<std::uint32_t>(t - static_cast<std::uint64_t>(static_cast<std::uint32_t>(cpp_dec_float_elem_mask) * static_cast<std::uint64_t>(carry)));
    }
-   else
+
+   return static_cast<std::uint32_t>(carry);
+}
+
+template <unsigned Digits10, class ExponentType, class Allocator>
+std::uint32_t cpp_dec_float<Digits10, ExponentType, Allocator>::div_loop_n(std::uint32_t* const u, std::uint32_t n, const std::int32_t p)
+{
+   std::uint64_t prev = static_cast<std::uint64_t>(0u);
+
+   for (std::int32_t j = static_cast<std::int32_t>(0); j < p; j++)
+   {
+      const std::uint64_t t = static_cast<std::uint64_t>(u[j] + static_cast<std::uint64_t>(prev * static_cast<std::uint32_t>(cpp_dec_float_elem_mask)));
+      u[j]                    = static_cast<std::uint32_t>(t / n);
+      prev                    = static_cast<std::uint64_t>(t - static_cast<std::uint64_t>(n * static_cast<std::uint64_t>(u[j])));
+   }
+
+   return static_cast<std::uint32_t>(prev);
+}
+
+template <unsigned Digits10, class ExponentType, class Allocator>
+void cpp_dec_float<Digits10, ExponentType, Allocator>::eval_multiply_kara_propagate_carry(std::uint32_t* t, const std::uint32_t n, const std::uint32_t carry)
+{
+   std::uint_fast8_t carry_out = ((carry != 0U) ? static_cast<std::uint_fast8_t>(1U)
+                                                : static_cast<std::uint_fast8_t>(0U));
+
+   using local_reverse_iterator_type = std::reverse_iterator<std::uint32_t*>;
+
+   local_reverse_iterator_type ri_t  (t + n);
+   local_reverse_iterator_type rend_t(t);
+
+   while((carry_out != 0U) && (ri_t != rend_t))
    {
-      // Compute and return 2^p.
-      if (p < static_cast<boost::long_long_type>(0))
+      const std::uint64_t tt = *ri_t + carry_out;
+
+      carry_out = ((tt >= static_cast<std::uint32_t>(cpp_dec_float_elem_mask)) ? static_cast<std::uint_fast8_t>(1U)
+                                                                               : static_cast<std::uint_fast8_t>(0U));
+
+      *ri_t++    = static_cast<std::uint32_t>(tt - ((carry_out != 0U) ? static_cast<std::uint32_t>(cpp_dec_float_elem_mask)
+                                                                      : static_cast<std::uint32_t>(0U)));
+   }
+}
+
+template <unsigned Digits10, class ExponentType, class Allocator>
+void cpp_dec_float<Digits10, ExponentType, Allocator>::eval_multiply_kara_propagate_borrow(std::uint32_t* t, const std::uint32_t n, const bool has_borrow)
+{
+   std::int_fast8_t borrow = (has_borrow ? static_cast<std::int_fast8_t>(1)
+                                         : static_cast<std::int_fast8_t>(0));
+
+   using local_reverse_iterator_type = std::reverse_iterator<std::uint32_t*>;
+
+   local_reverse_iterator_type ri_t  (t + n);
+   local_reverse_iterator_type rend_t(t);
+
+   while((borrow != 0U) && (ri_t != rend_t))
+   {
+      std::int32_t tt = static_cast<std::int32_t>(static_cast<std::int32_t>(*ri_t) - borrow);
+
+      // Underflow? Borrow?
+      if(tt < 0)
       {
-         return pow2(static_cast<boost::long_long_type>(-p)).calculate_inv();
+         // Yes, underflow and borrow
+         tt     += static_cast<std::int32_t>(cpp_dec_float_elem_mask);
+         borrow  = static_cast<int_fast8_t>(1);
       }
       else
       {
-         cpp_dec_float<Digits10, ExponentType, Allocator> t;
-         default_ops::detail::pow_imp(t, two(), p, mpl::true_());
-         return t;
+         borrow = static_cast<int_fast8_t>(0);
+      }
+
+      *ri_t++ = static_cast<std::uint32_t>(tt);
+   }
+}
+
+template <unsigned Digits10, class ExponentType, class Allocator>
+void cpp_dec_float<Digits10, ExponentType, Allocator>::eval_multiply_kara_n_by_n_to_2n(      std::uint32_t* r,
+                                                                                       const std::uint32_t* a,
+                                                                                       const std::uint32_t* b,
+                                                                                       const std::uint32_t  n,
+                                                                                             std::uint32_t* t)
+{
+   if(n <= 32U)
+   {
+      static_cast<void>(t);
+
+      eval_multiply_n_by_n_to_2n(r, a, b, n);
+   }
+   else
+   {
+      // Based on "Algorithm 1.3 KaratsubaMultiply", Sect. 1.3.2, page 5
+      // of R.P. Brent and P. Zimmermann, "Modern Computer Arithmetic",
+      // Cambridge University Press (2011).
+
+      // The Karatsuba multipliation computes the product of a*b as:
+      // [b^N + b^(N/2)] a1*b1 + [b^(N/2)](a1 - a0)(b0 - b1) + [b^(N/2) + 1] a0*b0
+
+      // Here we visualize a and b in two components 1,0 corresponding
+      // to the high and low order parts, respectively.
+
+      // Step 1
+      // Calculate a1*b1 and store it in the upper-order part of r.
+      // Calculate a0*b0 and store it in the lower-order part of r.
+      // copy r to t0.
+
+      // Step 2
+      // Add a1*b1 (which is t2) to the middle two-quarters of r (which is r1)
+      // Add a0*b0 (which is t0) to the middle two-quarters of r (which is r1)
+
+      // Step 3
+      // Calculate |a1-a0| in t0 and note the sign (i.e., the borrow flag)
+
+      // Step 4
+      // Calculate |b0-b1| in t1 and note the sign (i.e., the borrow flag)
+
+      // Step 5
+      // Call kara mul to calculate |a1-a0|*|b0-b1| in (t2),
+      // while using temporary storage in t4 along the way.
+
+      // Step 6
+      // Check the borrow signs. If a1-a0 and b0-b1 have the same signs,
+      // then add |a1-a0|*|b0-b1| to r1, otherwise subtract it from r1.
+
+      const std::uint_fast32_t  nh = n / 2U;
+
+      const std::uint32_t* a0 = a + nh;
+      const std::uint32_t* a1 = a + 0U;
+
+      const std::uint32_t* b0 = b + nh;
+      const std::uint32_t* b1 = b + 0U;
+
+            std::uint32_t* r0 = r + 0U;
+            std::uint32_t* r1 = r + nh;
+            std::uint32_t* r2 = r + n;
+
+            std::uint32_t* t0 = t + 0U;
+            std::uint32_t* t1 = t + nh;
+            std::uint32_t* t2 = t + n;
+            std::uint32_t* t4 = t + (n + n);
+
+      // Step 1
+      eval_multiply_kara_n_by_n_to_2n(r0, a1, b1, nh, t);
+      eval_multiply_kara_n_by_n_to_2n(r2, a0, b0, nh, t);
+      std::copy(r0, r0 + (2U * n), t0);
+
+      // Step 2
+      std::uint32_t carry;
+      carry = eval_add_n(r1, r1, t0, n);
+      eval_multiply_kara_propagate_carry(r0, nh, carry);
+      carry = eval_add_n(r1, r1, t2, n);
+      eval_multiply_kara_propagate_carry(r0, nh, carry);
+
+      // Step 3
+      const int cmp_result_a1a0 = compare_ranges(a1, a0, nh);
+
+      if(cmp_result_a1a0 == 1)
+         static_cast<void>(eval_subtract_n(t0, a1, a0, nh));
+      else if(cmp_result_a1a0 == -1)
+         static_cast<void>(eval_subtract_n(t0, a0, a1, nh));
+
+      // Step 4
+      const int cmp_result_b0b1 = compare_ranges(b0, b1, nh);
+
+      if(cmp_result_b0b1 == 1)
+         static_cast<void>(eval_subtract_n(t1, b0, b1, nh));
+      else if(cmp_result_b0b1 == -1)
+         static_cast<void>(eval_subtract_n(t1, b1, b0, nh));
+
+      // Step 5
+      eval_multiply_kara_n_by_n_to_2n(t2, t0, t1, nh, t4);
+
+      // Step 6
+      if((cmp_result_a1a0 * cmp_result_b0b1) == 1)
+      {
+         carry = eval_add_n(r1, r1, t2, n);
+
+         eval_multiply_kara_propagate_carry(r0, nh, carry);
+      }
+      else if((cmp_result_a1a0 * cmp_result_b0b1) == -1)
+      {
+         const bool has_borrow = eval_subtract_n(r1, r1, t2, n);
+
+         eval_multiply_kara_propagate_borrow(r0, nh, has_borrow);
       }
    }
 }
 
+template <unsigned Digits10, class ExponentType, class Allocator>
+cpp_dec_float<Digits10, ExponentType, Allocator> cpp_dec_float<Digits10, ExponentType, Allocator>::pow2(const long long p)
+{
+   static const std::array<cpp_dec_float<Digits10, ExponentType, Allocator>, 256u> local_pow2_data =
+   {{
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       29u, 38735877u,  5571876u, 99218413u, 43055614u, 19454666u, 38919302u, 18803771u, 87926569u, 60431486u, 36817932u, 12890625u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       58u, 77471754u, 11143753u, 98436826u, 86111228u, 38909332u, 77838604u, 37607543u, 75853139u, 20862972u, 73635864u, 25781250u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      117u, 54943508u, 22287507u, 96873653u, 72222456u, 77818665u, 55677208u, 75215087u, 51706278u, 41725945u, 47271728u, 51562500u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      235u,  9887016u, 44575015u, 93747307u, 44444913u, 55637331u, 11354417u, 50430175u,  3412556u, 83451890u, 94543457u,  3125000u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      470u, 19774032u, 89150031u, 87494614u, 88889827u, 11274662u, 22708835u,   860350u,  6825113u, 66903781u, 89086914u,  6250000u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      940u, 39548065u, 78300063u, 74989229u, 77779654u, 22549324u, 45417670u,  1720700u, 13650227u, 33807563u, 78173828u, 12500000u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     1880u, 79096131u, 56600127u, 49978459u, 55559308u, 45098648u, 90835340u,  3441400u, 27300454u, 67615127u, 56347656u, 25000000u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     3761u, 58192263u, 13200254u, 99956919u, 11118616u, 90197297u, 81670680u,  6882800u, 54600909u, 35230255u, 12695312u, 50000000u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     7523u, 16384526u, 26400509u, 99913838u, 22237233u, 80394595u, 63341360u, 13765601u,  9201818u, 70460510u, 25390625u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    15046u, 32769052u, 52801019u, 99827676u, 44474467u, 60789191u, 26682720u, 27531202u, 18403637u, 40921020u, 50781250u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    30092u, 65538105u,  5602039u, 99655352u, 88948935u, 21578382u, 53365440u, 55062404u, 36807274u, 81842041u,  1562500u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    60185u, 31076210u, 11204079u, 99310705u, 77897870u, 43156765u,  6730881u, 10124808u, 73614549u, 63684082u,  3125000u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   120370u, 62152420u, 22408159u, 98621411u, 55795740u, 86313530u, 13461762u, 20249617u, 47229099u, 27368164u,  6250000u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   240741u, 24304840u, 44816319u, 97242823u, 11591481u, 72627060u, 26923524u, 40499234u, 94458198u, 54736328u, 12500000u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   481482u, 48609680u, 89632639u, 94485646u, 23182963u, 45254120u, 53847048u, 80998469u, 88916397u,  9472656u, 25000000u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   962964u, 97219361u, 79265279u, 88971292u, 46365926u, 90508241u,  7694097u, 61996939u, 77832794u, 18945312u, 50000000u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  1925929u, 94438723u, 58530559u, 77942584u, 92731853u, 81016482u, 15388195u, 23993879u, 55665588u, 37890625u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  3851859u, 88877447u, 17061119u, 55885169u, 85463707u, 62032964u, 30776390u, 47987759u, 11331176u, 75781250u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  7703719u, 77754894u, 34122239u, 11770339u, 70927415u, 24065928u, 61552780u, 95975518u, 22662353u, 51562500u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 15407439u, 55509788u, 68244478u, 23540679u, 41854830u, 48131857u, 23105561u, 91951036u, 45324707u,  3125000u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 30814879u, 11019577u, 36488956u, 47081358u, 83709660u, 96263714u, 46211123u, 83902072u, 90649414u,  6250000u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 61629758u, 22039154u, 72977912u, 94162717u, 67419321u, 92527428u, 92422247u, 67804145u, 81298828u, 12500000u }, -40 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        1u, 23259516u, 44078309u, 45955825u, 88325435u, 34838643u, 85054857u, 84844495u, 35608291u, 62597656u, 25000000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        2u, 46519032u, 88156618u, 91911651u, 76650870u, 69677287u, 70109715u, 69688990u, 71216583u, 25195312u, 50000000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        4u, 93038065u, 76313237u, 83823303u, 53301741u, 39354575u, 40219431u, 39377981u, 42433166u, 50390625u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        9u, 86076131u, 52626475u, 67646607u,  6603482u, 78709150u, 80438862u, 78755962u, 84866333u,   781250u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       19u, 72152263u,  5252951u, 35293214u, 13206965u, 57418301u, 60877725u, 57511925u, 69732666u,  1562500u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       39u, 44304526u, 10505902u, 70586428u, 26413931u, 14836603u, 21755451u, 15023851u, 39465332u,  3125000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       78u, 88609052u, 21011805u, 41172856u, 52827862u, 29673206u, 43510902u, 30047702u, 78930664u,  6250000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      157u, 77218104u, 42023610u, 82345713u,  5655724u, 59346412u, 87021804u, 60095405u, 57861328u, 12500000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      315u, 54436208u, 84047221u, 64691426u, 11311449u, 18692825u, 74043609u, 20190811u, 15722656u, 25000000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      631u,  8872417u, 68094443u, 29382852u, 22622898u, 37385651u, 48087218u, 40381622u, 31445312u, 50000000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     1262u, 17744835u, 36188886u, 58765704u, 45245796u, 74771302u, 96174436u, 80763244u, 62890625u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     2524u, 35489670u, 72377773u, 17531408u, 90491593u, 49542605u, 92348873u, 61526489u, 25781250u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     5048u, 70979341u, 44755546u, 35062817u, 80983186u, 99085211u, 84697747u, 23052978u, 51562500u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    10097u, 41958682u, 89511092u, 70125635u, 61966373u, 98170423u, 69395494u, 46105957u,  3125000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    20194u, 83917365u, 79022185u, 40251271u, 23932747u, 96340847u, 38790988u, 92211914u,  6250000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    40389u, 67834731u, 58044370u, 80502542u, 47865495u, 92681694u, 77581977u, 84423828u, 12500000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    80779u, 35669463u, 16088741u, 61005084u, 95730991u, 85363389u, 55163955u, 68847656u, 25000000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   161558u, 71338926u, 32177483u, 22010169u, 91461983u, 70726779u, 10327911u, 37695312u, 50000000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   323117u, 42677852u, 64354966u, 44020339u, 82923967u, 41453558u, 20655822u, 75390625u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   646234u, 85355705u, 28709932u, 88040679u, 65847934u, 82907116u, 41311645u, 50781250u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  1292469u, 70711410u, 57419865u, 76081359u, 31695869u, 65814232u, 82623291u,  1562500u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  2584939u, 41422821u, 14839731u, 52162718u, 63391739u, 31628465u, 65246582u,  3125000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  5169878u, 82845642u, 29679463u,  4325437u, 26783478u, 63256931u, 30493164u,  6250000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 10339757u, 65691284u, 59358926u,  8650874u, 53566957u, 26513862u, 60986328u, 12500000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 20679515u, 31382569u, 18717852u, 17301749u,  7133914u, 53027725u, 21972656u, 25000000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 41359030u, 62765138u, 37435704u, 34603498u, 14267829u,  6055450u, 43945312u, 50000000u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 82718061u, 25530276u, 74871408u, 69206996u, 28535658u, 12110900u, 87890625u }, -32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        1u, 65436122u, 51060553u, 49742817u, 38413992u, 57071316u, 24221801u, 75781250u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        3u, 30872245u,  2121106u, 99485634u, 76827985u, 14142632u, 48443603u, 51562500u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        6u, 61744490u,  4242213u, 98971269u, 53655970u, 28285264u, 96887207u,  3125000u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       13u, 23488980u,  8484427u, 97942539u,  7311940u, 56570529u, 93774414u,  6250000u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       26u, 46977960u, 16968855u, 95885078u, 14623881u, 13141059u, 87548828u, 12500000u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       52u, 93955920u, 33937711u, 91770156u, 29247762u, 26282119u, 75097656u, 25000000u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      105u, 87911840u, 67875423u, 83540312u, 58495524u, 52564239u, 50195312u, 50000000u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      211u, 75823681u, 35750847u, 67080625u, 16991049u,  5128479u,   390625u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      423u, 51647362u, 71501695u, 34161250u, 33982098u, 10256958u,   781250u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      847u,  3294725u, 43003390u, 68322500u, 67964196u, 20513916u,  1562500u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     1694u,  6589450u, 86006781u, 36645001u, 35928392u, 41027832u,  3125000u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     3388u, 13178901u, 72013562u, 73290002u, 71856784u, 82055664u,  6250000u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     6776u, 26357803u, 44027125u, 46580005u, 43713569u, 64111328u, 12500000u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    13552u, 52715606u, 88054250u, 93160010u, 87427139u, 28222656u, 25000000u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    27105u,  5431213u, 76108501u, 86320021u, 74854278u, 56445312u, 50000000u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    54210u, 10862427u, 52217003u, 72640043u, 49708557u, 12890625u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   108420u, 21724855u,  4434007u, 45280086u, 99417114u, 25781250u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   216840u, 43449710u,  8868014u, 90560173u, 98834228u, 51562500u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   433680u, 86899420u, 17736029u, 81120347u, 97668457u,  3125000u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   867361u, 73798840u, 35472059u, 62240695u, 95336914u,  6250000u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  1734723u, 47597680u, 70944119u, 24481391u, 90673828u, 12500000u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  3469446u, 95195361u, 41888238u, 48962783u, 81347656u, 25000000u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  6938893u, 90390722u, 83776476u, 97925567u, 62695312u, 50000000u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 13877787u, 80781445u, 67552953u, 95851135u, 25390625u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 27755575u, 61562891u, 35105907u, 91702270u, 50781250u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 55511151u, 23125782u, 70211815u, 83404541u,  1562500u }, -24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        1u, 11022302u, 46251565u, 40423631u, 66809082u,  3125000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        2u, 22044604u, 92503130u, 80847263u, 33618164u,  6250000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        4u, 44089209u, 85006261u, 61694526u, 67236328u, 12500000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        8u, 88178419u, 70012523u, 23389053u, 34472656u, 25000000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       17u, 76356839u, 40025046u, 46778106u, 68945312u, 50000000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       35u, 52713678u, 80050092u, 93556213u, 37890625u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       71u,  5427357u, 60100185u, 87112426u, 75781250u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      142u, 10854715u, 20200371u, 74224853u, 51562500u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      284u, 21709430u, 40400743u, 48449707u,  3125000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      568u, 43418860u, 80801486u, 96899414u,  6250000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     1136u, 86837721u, 61602973u, 93798828u, 12500000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     2273u, 73675443u, 23205947u, 87597656u, 25000000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     4547u, 47350886u, 46411895u, 75195312u, 50000000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     9094u, 94701772u, 92823791u, 50390625u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    18189u, 89403545u, 85647583u,   781250u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    36379u, 78807091u, 71295166u,  1562500u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    72759u, 57614183u, 42590332u,  3125000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   145519u, 15228366u, 85180664u,  6250000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   291038u, 30456733u, 70361328u, 12500000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   582076u, 60913467u, 40722656u, 25000000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  1164153u, 21826934u, 81445312u, 50000000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  2328306u, 43653869u, 62890625u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  4656612u, 87307739u, 25781250u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  9313225u, 74615478u, 51562500u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 18626451u, 49230957u,  3125000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 37252902u, 98461914u,  6250000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 74505805u, 96923828u, 12500000u }, -16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        1u, 49011611u, 93847656u, 25000000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        2u, 98023223u, 87695312u, 50000000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        5u, 96046447u, 75390625u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       11u, 92092895u, 50781250u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       23u, 84185791u,  1562500u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       47u, 68371582u,  3125000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       95u, 36743164u,  6250000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      190u, 73486328u, 12500000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      381u, 46972656u, 25000000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      762u, 93945312u, 50000000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     1525u, 87890625u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     3051u, 75781250u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     6103u, 51562500u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    12207u,  3125000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    24414u,  6250000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    48828u, 12500000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    97656u, 25000000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   195312u, 50000000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   390625u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   781250u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  1562500u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  3125000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  6250000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 12500000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 25000000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 50000000u }, -8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        1u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        2u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        4u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        8u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       16u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       32u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       64u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      128u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      256u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      512u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     1024u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     2048u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     4096u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     8192u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    16384u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    32768u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    65536u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   131072u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   262144u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   524288u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  1048576u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  2097152u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  4194304u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  8388608u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 16777216u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 33554432u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 67108864u },  0 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        1u, 34217728u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        2u, 68435456u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        5u, 36870912u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       10u, 73741824u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       21u, 47483648u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       42u, 94967296u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       85u, 89934592u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      171u, 79869184u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      343u, 59738368u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      687u, 19476736u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     1374u, 38953472u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     2748u, 77906944u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     5497u, 55813888u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    10995u, 11627776u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    21990u, 23255552u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    43980u, 46511104u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    87960u, 93022208u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   175921u, 86044416u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   351843u, 72088832u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   703687u, 44177664u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  1407374u, 88355328u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  2814749u, 76710656u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  5629499u, 53421312u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 11258999u,  6842624u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 22517998u, 13685248u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 45035996u, 27370496u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 90071992u, 54740992u },  8 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        1u, 80143985u,  9481984u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        3u, 60287970u, 18963968u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        7u, 20575940u, 37927936u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       14u, 41151880u, 75855872u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       28u, 82303761u, 51711744u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       57u, 64607523u,  3423488u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      115u, 29215046u,  6846976u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      230u, 58430092u, 13693952u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      461u, 16860184u, 27387904u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      922u, 33720368u, 54775808u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     1844u, 67440737u,  9551616u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     3689u, 34881474u, 19103232u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     7378u, 69762948u, 38206464u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    14757u, 39525896u, 76412928u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    29514u, 79051793u, 52825856u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    59029u, 58103587u,  5651712u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   118059u, 16207174u, 11303424u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   236118u, 32414348u, 22606848u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   472236u, 64828696u, 45213696u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   944473u, 29657392u, 90427392u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  1888946u, 59314785u, 80854784u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  3777893u, 18629571u, 61709568u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  7555786u, 37259143u, 23419136u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 15111572u, 74518286u, 46838272u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 30223145u, 49036572u, 93676544u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 60446290u, 98073145u, 87353088u }, 16 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        1u, 20892581u, 96146291u, 74706176u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        2u, 41785163u, 92292583u, 49412352u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        4u, 83570327u, 84585166u, 98824704u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        9u, 67140655u, 69170333u, 97649408u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       19u, 34281311u, 38340667u, 95298816u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       38u, 68562622u, 76681335u, 90597632u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       77u, 37125245u, 53362671u, 81195264u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      154u, 74250491u,  6725343u, 62390528u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      309u, 48500982u, 13450687u, 24781056u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      618u, 97001964u, 26901374u, 49562112u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     1237u, 94003928u, 53802748u, 99124224u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     2475u, 88007857u,  7605497u, 98248448u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     4951u, 76015714u, 15210995u, 96496896u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     9903u, 52031428u, 30421991u, 92993792u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    19807u,  4062856u, 60843983u, 85987584u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    39614u,  8125713u, 21687967u, 71975168u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    79228u, 16251426u, 43375935u, 43950336u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   158456u, 32502852u, 86751870u, 87900672u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   316912u, 65005705u, 73503741u, 75801344u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   633825u, 30011411u, 47007483u, 51602688u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  1267650u, 60022822u, 94014967u,  3205376u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  2535301u, 20045645u, 88029934u,  6410752u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  5070602u, 40091291u, 76059868u, 12821504u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 10141204u, 80182583u, 52119736u, 25643008u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 20282409u, 60365167u,  4239472u, 51286016u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 40564819u, 20730334u,  8478945u,  2572032u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( { 81129638u, 41460668u, 16957890u,  5144064u }, 24 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        1u, 62259276u, 82921336u, 33915780u, 10288128u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        3u, 24518553u, 65842672u, 67831560u, 20576256u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {        6u, 49037107u, 31685345u, 35663120u, 41152512u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       12u, 98074214u, 63370690u, 71326240u, 82305024u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       25u, 96148429u, 26741381u, 42652481u, 64610048u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {       51u, 92296858u, 53482762u, 85304963u, 29220096u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      103u, 84593717u,  6965525u, 70609926u, 58440192u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      207u, 69187434u, 13931051u, 41219853u, 16880384u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      415u, 38374868u, 27862102u, 82439706u, 33760768u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {      830u, 76749736u, 55724205u, 64879412u, 67521536u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     1661u, 53499473u, 11448411u, 29758825u, 35043072u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     3323u,  6998946u, 22896822u, 59517650u, 70086144u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {     6646u, 13997892u, 45793645u, 19035301u, 40172288u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    13292u, 27995784u, 91587290u, 38070602u, 80344576u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    26584u, 55991569u, 83174580u, 76141205u, 60689152u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {    53169u, 11983139u, 66349161u, 52282411u, 21378304u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   106338u, 23966279u, 32698323u,  4564822u, 42756608u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   212676u, 47932558u, 65396646u,  9129644u, 85513216u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   425352u, 95865117u, 30793292u, 18259289u, 71026432u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {   850705u, 91730234u, 61586584u, 36518579u, 42052864u }, 32 ),
+      cpp_dec_float<Digits10, ExponentType, Allocator>::from_lst( {  1701411u, 83460469u, 23173168u, 73037158u, 84105728u }, 32 ),
+   }};
+
+   cpp_dec_float<Digits10, ExponentType, Allocator> t;
+
+   if(p < -128L)
+      default_ops::detail::pow_imp(t, cpp_dec_float<Digits10, ExponentType, Allocator>::half(), static_cast<unsigned long long>(-p), std::integral_constant<bool, false>());
+   else if ((p >= -128L) && (p <= 127L))
+      t = local_pow2_data[std::size_t(p + 128)];
+   else
+      default_ops::detail::pow_imp(t, cpp_dec_float<Digits10, ExponentType, Allocator>::two(), static_cast<unsigned long long>(p), std::integral_constant<bool, false>());
+
+   return t;
+}
+
 template <unsigned Digits10, class ExponentType, class Allocator>
 inline void eval_add(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const cpp_dec_float<Digits10, ExponentType, Allocator>& o)
 {
@@ -2726,28 +3149,28 @@ inline void eval_divide(cpp_dec_float<Digits10, ExponentType, Allocator>& result
 }
 
 template <unsigned Digits10, class ExponentType, class Allocator>
-inline void eval_add(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const boost::ulong_long_type& o)
+inline void eval_add(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const unsigned long long& o)
 {
    result.add_unsigned_long_long(o);
 }
 template <unsigned Digits10, class ExponentType, class Allocator>
-inline void eval_subtract(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const boost::ulong_long_type& o)
+inline void eval_subtract(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const unsigned long long& o)
 {
    result.sub_unsigned_long_long(o);
 }
 template <unsigned Digits10, class ExponentType, class Allocator>
-inline void eval_multiply(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const boost::ulong_long_type& o)
+inline void eval_multiply(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const unsigned long long& o)
 {
    result.mul_unsigned_long_long(o);
 }
 template <unsigned Digits10, class ExponentType, class Allocator>
-inline void eval_divide(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const boost::ulong_long_type& o)
+inline void eval_divide(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const unsigned long long& o)
 {
    result.div_unsigned_long_long(o);
 }
 
 template <unsigned Digits10, class ExponentType, class Allocator>
-inline void eval_add(cpp_dec_float<Digits10, ExponentType, Allocator>& result, boost::long_long_type o)
+inline void eval_add(cpp_dec_float<Digits10, ExponentType, Allocator>& result, long long o)
 {
    if (o < 0)
       result.sub_unsigned_long_long(boost::multiprecision::detail::unsigned_abs(o));
@@ -2755,7 +3178,7 @@ inline void eval_add(cpp_dec_float<Digits10, ExponentType, Allocator>& result, b
       result.add_unsigned_long_long(o);
 }
 template <unsigned Digits10, class ExponentType, class Allocator>
-inline void eval_subtract(cpp_dec_float<Digits10, ExponentType, Allocator>& result, boost::long_long_type o)
+inline void eval_subtract(cpp_dec_float<Digits10, ExponentType, Allocator>& result, long long o)
 {
    if (o < 0)
       result.add_unsigned_long_long(boost::multiprecision::detail::unsigned_abs(o));
@@ -2763,7 +3186,7 @@ inline void eval_subtract(cpp_dec_float<Digits10, ExponentType, Allocator>& resu
       result.sub_unsigned_long_long(o);
 }
 template <unsigned Digits10, class ExponentType, class Allocator>
-inline void eval_multiply(cpp_dec_float<Digits10, ExponentType, Allocator>& result, boost::long_long_type o)
+inline void eval_multiply(cpp_dec_float<Digits10, ExponentType, Allocator>& result, long long o)
 {
    if (o < 0)
    {
@@ -2774,7 +3197,7 @@ inline void eval_multiply(cpp_dec_float<Digits10, ExponentType, Allocator>& resu
       result.mul_unsigned_long_long(o);
 }
 template <unsigned Digits10, class ExponentType, class Allocator>
-inline void eval_divide(cpp_dec_float<Digits10, ExponentType, Allocator>& result, boost::long_long_type o)
+inline void eval_divide(cpp_dec_float<Digits10, ExponentType, Allocator>& result, long long o)
 {
    if (o < 0)
    {
@@ -2782,19 +3205,31 @@ inline void eval_divide(cpp_dec_float<Digits10, ExponentType, Allocator>& result
       result.negate();
    }
    else
-      result.div_unsigned_long_long(o);
+      result.div_unsigned_long_long(static_cast<unsigned long long>(o));
 }
 
 template <unsigned Digits10, class ExponentType, class Allocator>
-inline void eval_convert_to(boost::ulong_long_type* result, const cpp_dec_float<Digits10, ExponentType, Allocator>& val)
+inline void eval_convert_to(unsigned long long* result, const cpp_dec_float<Digits10, ExponentType, Allocator>& val)
 {
    *result = val.extract_unsigned_long_long();
 }
 template <unsigned Digits10, class ExponentType, class Allocator>
-inline void eval_convert_to(boost::long_long_type* result, const cpp_dec_float<Digits10, ExponentType, Allocator>& val)
+inline void eval_convert_to(long long* result, const cpp_dec_float<Digits10, ExponentType, Allocator>& val)
 {
    *result = val.extract_signed_long_long();
 }
+#ifdef BOOST_HAS_INT128
+template <unsigned Digits10, class ExponentType, class Allocator>
+inline void eval_convert_to(uint128_type* result, const cpp_dec_float<Digits10, ExponentType, Allocator>& val)
+{
+   *result = val.extract_unsigned_int128();
+}
+template <unsigned Digits10, class ExponentType, class Allocator>
+inline void eval_convert_to(int128_type* result, const cpp_dec_float<Digits10, ExponentType, Allocator>& val)
+{
+   *result = val.extract_signed_int128();
+}
+#endif
 template <unsigned Digits10, class ExponentType, class Allocator>
 inline void eval_convert_to(long double* result, const cpp_dec_float<Digits10, ExponentType, Allocator>& val)
 {
@@ -2805,6 +3240,13 @@ inline void eval_convert_to(double* result, const cpp_dec_float<Digits10, Expone
 {
    *result = val.extract_double();
 }
+#if defined(BOOST_HAS_FLOAT128)
+template <unsigned Digits10, class ExponentType, class Allocator>
+inline void eval_convert_to(float128_type* result, const cpp_dec_float<Digits10, ExponentType, Allocator>& val)
+{
+   *result = float128_procs::strtoflt128(val.str(0, std::ios_base::scientific).c_str(), nullptr);
+}
+#endif
 
 //
 // Non member function support:
@@ -2893,7 +3335,7 @@ template <unsigned Digits10, class ExponentType, class Allocator>
 inline ExponentType eval_ilogb(const cpp_dec_float<Digits10, ExponentType, Allocator>& val)
 {
    if (val.iszero())
-      return (std::numeric_limits<ExponentType>::min)();
+      return (std::numeric_limits<typename cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type>::min)();
    if ((val.isinf)())
       return INT_MAX;
    if ((val.isnan)())
@@ -2909,7 +3351,7 @@ template <unsigned Digits10, class ExponentType, class Allocator, class ArgType>
 inline void eval_scalbn(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const cpp_dec_float<Digits10, ExponentType, Allocator>& val, ArgType e_)
 {
    using default_ops::eval_multiply;
-   const ExponentType                               e = static_cast<ExponentType>(e_);
+   const typename cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type                               e = static_cast<typename cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type>(e_);
    cpp_dec_float<Digits10, ExponentType, Allocator> t(1.0, e);
    eval_multiply(result, val, t);
 }
@@ -2917,22 +3359,22 @@ inline void eval_scalbn(cpp_dec_float<Digits10, ExponentType, Allocator>& result
 template <unsigned Digits10, class ExponentType, class Allocator, class ArgType>
 inline void eval_ldexp(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const cpp_dec_float<Digits10, ExponentType, Allocator>& x, ArgType e)
 {
-   const boost::long_long_type the_exp = static_cast<boost::long_long_type>(e);
+   const long long the_exp = static_cast<long long>(e);
 
-   if ((the_exp > (std::numeric_limits<ExponentType>::max)()) || (the_exp < (std::numeric_limits<ExponentType>::min)()))
-      BOOST_THROW_EXCEPTION(std::runtime_error(std::string("Exponent value is out of range.")));
+   if ((the_exp > (std::numeric_limits<typename cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type>::max)()) || (the_exp < (std::numeric_limits<typename cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type>::min)()))
+      BOOST_MP_THROW_EXCEPTION(std::runtime_error(std::string("Exponent value is out of range.")));
 
    result = x;
 
-   if ((the_exp > static_cast<boost::long_long_type>(-std::numeric_limits<boost::long_long_type>::digits)) && (the_exp < static_cast<boost::long_long_type>(0)))
-      result.div_unsigned_long_long(1ULL << static_cast<boost::long_long_type>(-the_exp));
-   else if ((the_exp < static_cast<boost::long_long_type>(std::numeric_limits<boost::long_long_type>::digits)) && (the_exp > static_cast<boost::long_long_type>(0)))
+   if ((the_exp > static_cast<long long>(-std::numeric_limits<long long>::digits)) && (the_exp < static_cast<long long>(0)))
+      result.div_unsigned_long_long(1ULL << static_cast<long long>(-the_exp));
+   else if ((the_exp < static_cast<long long>(std::numeric_limits<long long>::digits)) && (the_exp > static_cast<long long>(0)))
       result.mul_unsigned_long_long(1ULL << the_exp);
-   else if (the_exp != static_cast<boost::long_long_type>(0))
+   else if (the_exp != static_cast<long long>(0))
    {
       if ((the_exp < cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_min_exp / 2) && (x.order() > 0))
       {
-         boost::long_long_type half_exp = e / 2;
+         long long half_exp = e / 2;
          cpp_dec_float<Digits10, ExponentType, Allocator> t = cpp_dec_float<Digits10, ExponentType, Allocator>::pow2(half_exp);
          result *= t;
          if (2 * half_exp != e)
@@ -2958,9 +3400,9 @@ inline void eval_frexp(cpp_dec_float<Digits10, ExponentType, Allocator>& result,
    if (result.isneg())
       result.negate();
 
-   ExponentType t = result.order();
+   typename cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type t = result.order();
    BOOST_MP_USING_ABS
-   if (abs(t) < ((std::numeric_limits<ExponentType>::max)() / 1000))
+   if (abs(t) < ((std::numeric_limits<typename cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type>::max)() / 1000))
    {
       t *= 1000;
       t /= 301;
@@ -2986,14 +3428,14 @@ inline void eval_frexp(cpp_dec_float<Digits10, ExponentType, Allocator>& result,
    if (abs(result.order()) > 5)
    {
       // If our first estimate doesn't get close enough then try recursion until we do:
-      ExponentType                                     e2;
-      cpp_dec_float<Digits10, ExponentType, Allocator> r2;
+      typename cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type e2;
+      cpp_dec_float<Digits10, ExponentType, Allocator>                         r2;
       eval_frexp(r2, result, &e2);
       // overflow protection:
-      if ((t > 0) && (e2 > 0) && (t > (std::numeric_limits<ExponentType>::max)() - e2))
-         BOOST_THROW_EXCEPTION(std::runtime_error("Exponent is too large to be represented as a power of 2."));
-      if ((t < 0) && (e2 < 0) && (t < (std::numeric_limits<ExponentType>::min)() - e2))
-         BOOST_THROW_EXCEPTION(std::runtime_error("Exponent is too large to be represented as a power of 2."));
+      if ((t > 0) && (e2 > 0) && (t > (std::numeric_limits<typename cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type>::max)() - e2))
+         BOOST_MP_THROW_EXCEPTION(std::runtime_error("Exponent is too large to be represented as a power of 2."));
+      if ((t < 0) && (e2 < 0) && (t < (std::numeric_limits<typename cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type>::min)() - e2))
+         BOOST_MP_THROW_EXCEPTION(std::runtime_error("Exponent is too large to be represented as a power of 2."));
       t += e2;
       result = r2;
    }
@@ -3014,12 +3456,12 @@ inline void eval_frexp(cpp_dec_float<Digits10, ExponentType, Allocator>& result,
 }
 
 template <unsigned Digits10, class ExponentType, class Allocator>
-inline typename disable_if<is_same<ExponentType, int> >::type eval_frexp(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const cpp_dec_float<Digits10, ExponentType, Allocator>& x, int* e)
+inline typename std::enable_if< !std::is_same<ExponentType, int>::value>::type eval_frexp(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const cpp_dec_float<Digits10, ExponentType, Allocator>& x, int* e)
 {
-   ExponentType t;
+   typename cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type t;
    eval_frexp(result, x, &t);
    if ((t > (std::numeric_limits<int>::max)()) || (t < (std::numeric_limits<int>::min)()))
-      BOOST_THROW_EXCEPTION(std::runtime_error("Exponent is outside the range of an int"));
+      BOOST_MP_THROW_EXCEPTION(std::runtime_error("Exponent is outside the range of an int"));
    *e = static_cast<int>(t);
 }
 
@@ -3044,8 +3486,8 @@ inline std::size_t hash_value(const cpp_dec_float<Digits10, ExponentType, Alloca
 
 using boost::multiprecision::backends::cpp_dec_float;
 
-typedef number<cpp_dec_float<50> >  cpp_dec_float_50;
-typedef number<cpp_dec_float<100> > cpp_dec_float_100;
+using cpp_dec_float_50 = number<cpp_dec_float<50> > ;
+using cpp_dec_float_100 = number<cpp_dec_float<100> >;
 
 namespace detail {
 
@@ -3061,17 +3503,9 @@ struct transcendental_reduction_type<boost::multiprecision::backends::cpp_dec_fl
    // 
    // See ARGUMENT REDUCTION FOR HUGE ARGUMENTS. K C Ng.
    //
-   typedef boost::multiprecision::backends::cpp_dec_float<Digits10 * 3, ExponentType, Allocator> type;
+   using type = boost::multiprecision::backends::cpp_dec_float<Digits10 * 3, ExponentType, Allocator>;
 };
 
-#ifdef BOOST_NO_SFINAE_EXPR
-
-template <unsigned D1, class E1, class A1, unsigned D2, class E2, class A2>
-struct is_explicitly_convertible<cpp_dec_float<D1, E1, A1>, cpp_dec_float<D2, E2, A2> > : public mpl::true_
-{};
-
-#endif
-
 } // namespace detail
 
 
@@ -3082,91 +3516,89 @@ template <unsigned Digits10, class ExponentType, class Allocator, boost::multipr
 class numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >
 {
  public:
-   BOOST_STATIC_CONSTEXPR bool is_specialized                      = true;
-   BOOST_STATIC_CONSTEXPR bool is_signed                           = true;
-   BOOST_STATIC_CONSTEXPR bool is_integer                          = false;
-   BOOST_STATIC_CONSTEXPR bool is_exact                            = false;
-   BOOST_STATIC_CONSTEXPR bool is_bounded                          = true;
-   BOOST_STATIC_CONSTEXPR bool is_modulo                           = false;
-   BOOST_STATIC_CONSTEXPR bool is_iec559                           = false;
-   BOOST_STATIC_CONSTEXPR int  digits                              = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_digits10;
-   BOOST_STATIC_CONSTEXPR int  digits10                            = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_digits10;
-   BOOST_STATIC_CONSTEXPR int  max_digits10                        = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_total_digits10;
-   BOOST_STATIC_CONSTEXPR ExponentType min_exponent                = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_min_exp;   // Type differs from int.
-   BOOST_STATIC_CONSTEXPR ExponentType min_exponent10              = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_min_exp10; // Type differs from int.
-   BOOST_STATIC_CONSTEXPR ExponentType max_exponent                = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_max_exp;   // Type differs from int.
-   BOOST_STATIC_CONSTEXPR ExponentType max_exponent10              = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_max_exp10; // Type differs from int.
-   BOOST_STATIC_CONSTEXPR int          radix                       = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_radix;
-   BOOST_STATIC_CONSTEXPR std::float_round_style round_style       = std::round_indeterminate;
-   BOOST_STATIC_CONSTEXPR bool                   has_infinity      = true;
-   BOOST_STATIC_CONSTEXPR bool                   has_quiet_NaN     = true;
-   BOOST_STATIC_CONSTEXPR bool                   has_signaling_NaN = false;
-   BOOST_STATIC_CONSTEXPR std::float_denorm_style has_denorm       = std::denorm_absent;
-   BOOST_STATIC_CONSTEXPR bool                    has_denorm_loss  = false;
-   BOOST_STATIC_CONSTEXPR bool                    traps            = false;
-   BOOST_STATIC_CONSTEXPR bool                    tinyness_before  = false;
-
-   BOOST_STATIC_CONSTEXPR boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates>(min)() { return (boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::min)(); }
-   BOOST_STATIC_CONSTEXPR boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates>(max)() { return (boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::max)(); }
-   BOOST_STATIC_CONSTEXPR boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> lowest() { return boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::zero(); }
-   BOOST_STATIC_CONSTEXPR boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> epsilon() { return boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::eps(); }
-   BOOST_STATIC_CONSTEXPR boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> round_error() { return 0.5L; }
-   BOOST_STATIC_CONSTEXPR boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> infinity() { return boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::inf(); }
-   BOOST_STATIC_CONSTEXPR boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> quiet_NaN() { return boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::nan(); }
-   BOOST_STATIC_CONSTEXPR boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> signaling_NaN() { return boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::zero(); }
-   BOOST_STATIC_CONSTEXPR boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> denorm_min() { return boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::zero(); }
+   static constexpr bool                    is_specialized    = true;
+   static constexpr bool                    is_signed         = true;
+   static constexpr bool                    is_integer        = false;
+   static constexpr bool                    is_exact          = false;
+   static constexpr bool                    is_bounded        = true;
+   static constexpr bool                    is_modulo         = false;
+   static constexpr bool                    is_iec559         = false;
+   static constexpr int                     digits            = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_digits10;
+   static constexpr int                     digits10          = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_digits10;
+   static constexpr int                     max_digits10      = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_max_digits10;
+   static constexpr typename boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type min_exponent                = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_min_exp;   // Type differs from int.
+   static constexpr typename boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type min_exponent10              = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_min_exp10; // Type differs from int.
+   static constexpr typename boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type max_exponent                = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_max_exp;   // Type differs from int.
+   static constexpr typename boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type max_exponent10              = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_max_exp10; // Type differs from int.
+   static constexpr int                     radix             = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_radix;
+   static constexpr std::float_round_style  round_style       = std::round_indeterminate;
+   static constexpr bool                    has_infinity      = true;
+   static constexpr bool                    has_quiet_NaN     = true;
+   static constexpr bool                    has_signaling_NaN = false;
+   static constexpr std::float_denorm_style has_denorm        = std::denorm_absent;
+   static constexpr bool                    has_denorm_loss   = false;
+   static constexpr bool                    traps             = false;
+   static constexpr bool                    tinyness_before   = false;
+
+   static constexpr boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates>(min)() { return (boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::min)(); }
+   static constexpr boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates>(max)() { return (boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::max)(); }
+   static constexpr boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> lowest() { return boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::zero(); }
+   static constexpr boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> epsilon() { return boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::eps(); }
+   static constexpr boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> round_error() { return 0.5L; }
+   static constexpr boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> infinity() { return boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::inf(); }
+   static constexpr boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> quiet_NaN() { return boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::nan(); }
+   static constexpr boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> signaling_NaN() { return boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::zero(); }
+   static constexpr boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> denorm_min() { return boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::zero(); }
 };
 
-#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
-
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::digits;
+constexpr int numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::digits;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::digits10;
+constexpr int numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::digits10;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::max_digits10;
+constexpr int numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::max_digits10;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::is_signed;
+constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::is_signed;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::is_integer;
+constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::is_integer;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::is_exact;
+constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::is_exact;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::radix;
+constexpr int numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::radix;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST ExponentType numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::min_exponent;
+constexpr typename boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::min_exponent;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST ExponentType numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::min_exponent10;
+constexpr typename boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::min_exponent10;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST ExponentType numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::max_exponent;
+constexpr typename boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::max_exponent;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST ExponentType numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::max_exponent10;
+constexpr typename boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::max_exponent10;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::has_infinity;
+constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::has_infinity;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::has_quiet_NaN;
+constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::has_quiet_NaN;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::has_signaling_NaN;
+constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::has_signaling_NaN;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST float_denorm_style numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::has_denorm;
+constexpr float_denorm_style numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::has_denorm;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::has_denorm_loss;
+constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::has_denorm_loss;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::is_iec559;
+constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::is_iec559;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::is_bounded;
+constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::is_bounded;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::is_modulo;
+constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::is_modulo;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::traps;
+constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::traps;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::tinyness_before;
+constexpr bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::tinyness_before;
 template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST float_round_style numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::round_style;
+constexpr float_round_style numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >::round_style;
 
-#endif
 } // namespace std
 
+#ifdef BOOST_MP_MATH_AVAILABLE
 namespace boost {
 namespace math {
 
@@ -3177,21 +3609,22 @@ struct precision<boost::multiprecision::number<boost::multiprecision::cpp_dec_fl
 {
    // Define a local copy of cpp_dec_float_digits10 because it might differ
    // from the template parameter Digits10 for small or large digit counts.
-   static const boost::int32_t cpp_dec_float_digits10 = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_digits10;
+   static constexpr std::int32_t cpp_dec_float_digits10 = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_digits10;
 
-   typedef typename Policy::precision_type                            precision_type;
-   typedef digits2<((cpp_dec_float_digits10 + 1LL) * 1000LL) / 301LL> digits_2;
-   typedef typename mpl::if_c<
+   using precision_type = typename Policy::precision_type                           ;
+   using digits_2 = digits2<((cpp_dec_float_digits10 + 1LL) * 1000LL) / 301LL>;
+   using type = typename std::conditional<
        ((digits_2::value <= precision_type::value) || (Policy::precision_type::value <= 0)),
        // Default case, full precision for RealType:
        digits_2,
        // User customized precision:
-       precision_type>::type type;
+       precision_type>::type;
 };
 
 }
 
 }} // namespace boost::math::policies
+#endif
 
 #ifdef BOOST_MSVC
 #pragma warning(pop)