Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86292 - in sandbox/multiprecision.cpp_bin_float: boost/multiprecision boost/multiprecision/cpp_bin_float libs/multiprecision/performance libs/multiprecision/test libs/multiprecision/test/math
From: john_at_[hidden]
Date: 2013-10-13 13:33:22


Author: johnmaddock
Date: 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013)
New Revision: 86292
URL: http://svn.boost.org/trac/boost/changeset/86292

Log:
Change the cpp_bin_float interface.

Text files modified:
   sandbox/multiprecision.cpp_bin_float/boost/multiprecision/cpp_bin_float.hpp | 600 ++++++++++++++++++++-------------------
   sandbox/multiprecision.cpp_bin_float/boost/multiprecision/cpp_bin_float/io.hpp | 62 ++--
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/performance_test.cpp | 6
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_bessel2.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_bessel6.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_nct3.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_nct6.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_poly.cpp | 4
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/math/setup.hpp | 6
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_acos.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_arithmetic_cpp_bin_float_1.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_asin.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_atan.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cos.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cosh.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cpp_bin_float.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cpp_bin_float_io.cpp | 21
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_exp.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_fpclassify.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_log.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_numeric_limits.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_pow.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_sin.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_sinh.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_sqrt.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_tan.cpp | 2
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_tanh.cpp | 2
   27 files changed, 379 insertions(+), 362 deletions(-)

Modified: sandbox/multiprecision.cpp_bin_float/boost/multiprecision/cpp_bin_float.hpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/boost/multiprecision/cpp_bin_float.hpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/boost/multiprecision/cpp_bin_float.hpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -13,20 +13,27 @@
 
 namespace boost{ namespace multiprecision{ namespace backends{
 
-template <unsigned Bits>
+enum digit_base_type
+{
+ digit_base_2 = 2,
+ digit_base_10 = 10
+};
+
+template <unsigned Digits, digit_base_type DigitBase = digit_base_10, class Allocator = void>
 class cpp_bin_float
 {
 public:
- typedef cpp_int_backend<Bits, Bits, unsigned_magnitude, unchecked, void> rep_type;
- typedef cpp_int_backend<2 * Bits, 2 * Bits, unsigned_magnitude, unchecked, void> double_rep_type;
+ static const unsigned bit_count = DigitBase == digit_base_2 ? Digits : (Digits * 1000uL) / 301uL + ((Digits * 1000uL) % 301 ? 2u : 1u);
+ typedef cpp_int_backend<bit_count, bit_count, unsigned_magnitude, unchecked, Allocator> rep_type;
+ typedef cpp_int_backend<2 * bit_count, 2 * bit_count, unsigned_magnitude, unchecked, Allocator> double_rep_type;
 
    typedef typename rep_type::signed_types signed_types;
    typedef typename rep_type::unsigned_types unsigned_types;
    typedef boost::mpl::list<double, long double> float_types;
    typedef int exponent_type;
 
- static const int max_exponent = boost::integer_traits<int>::const_max - 2 * Bits;
- static const int min_exponent = boost::integer_traits<int>::const_min + 2 * static_cast<int>(Bits);
+ static const int max_exponent = boost::integer_traits<int>::const_max - 2 * bit_count;
+ static const int min_exponent = boost::integer_traits<int>::const_min + 2 * static_cast<int>(bit_count);
 
    static const int exponent_zero = max_exponent + 1;
    static const int exponent_infinity = max_exponent + 2;
@@ -163,17 +170,17 @@
       m_sign = false;
       m_exponent = 0;
 
- static const int bits = sizeof(int) * CHAR_BIT - 1;
+ static const int cpp_bin_float<Digits, DigitBase, Allocator>::bit_count = sizeof(int) * CHAR_BIT - 1;
       int e;
       eval_frexp(f, f, &e);
       while(eval_get_sign(f) != 0)
       {
- eval_ldexp(f, f, bits);
- e -= bits;
+ eval_ldexp(f, f, cpp_bin_float<Digits, DigitBase, Allocator>::bit_count);
+ e -= cpp_bin_float<Digits, DigitBase, Allocator>::bit_count;
          int ipart;
          eval_convert_to(&ipart, f);
          eval_subtract(f, static_cast<f_int_type>(ipart));
- m_exponent += bits;
+ m_exponent += cpp_bin_float<Digits, DigitBase, Allocator>::bit_count;
          eval_add(*this, static_cast<bf_int_type>(ipart));
       }
       m_exponent += e;
@@ -211,8 +218,8 @@
          m_data = static_cast<ar_type>(fi);
          unsigned shift = msb(fi);
          m_exponent = shift;
- eval_left_shift(m_data, Bits - shift - 1);
- BOOST_ASSERT(eval_bit_test(m_data, Bits-1));
+ eval_left_shift(m_data, bit_count - shift - 1);
+ BOOST_ASSERT(eval_bit_test(m_data, bit_count-1));
          m_sign = i < 0;
       }
       return *this;
@@ -275,7 +282,7 @@
       using default_ops::eval_is_zero;
       if((m_exponent <= max_exponent) && (m_exponent >= min_exponent))
       {
- BOOST_ASSERT(eval_bit_test(m_data, Bits - 1));
+ BOOST_ASSERT(eval_bit_test(m_data, bit_count - 1));
       }
       else
       {
@@ -286,11 +293,11 @@
    }
 };
 
-template <unsigned bits, class Int>
-inline void copy_and_round(cpp_bin_float<bits> &res, Int &arg)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator, class Int>
+inline void copy_and_round(cpp_bin_float<Digits, DigitBase, Allocator> &res, Int &arg)
 {
    // Precondition: exponent of res must have been set before this function is called
- // as we may need to adjust it based on how many bits in arg are set.
+ // as we may need to adjust it based on how many cpp_bin_float<Digits, DigitBase, Allocator>::bit_count in arg are set.
    using default_ops::eval_msb;
    using default_ops::eval_lsb;
    using default_ops::eval_left_shift;
@@ -302,37 +309,37 @@
    // cancellation may have resulted in arg being all zeros:
    if(eval_get_sign(arg) == 0)
    {
- res.exponent() = cpp_bin_float<bits>::exponent_zero;
+ res.exponent() = cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero;
       res.sign() = false;
       res.bits() = static_cast<limb_type>(0u);
       return;
    }
    unsigned msb = eval_msb(arg);
- if(bits > msb + 1)
+ if(cpp_bin_float<Digits, DigitBase, Allocator>::bit_count > msb + 1)
    {
       // Must have had cancellation in subtraction, shift left and copy:
- eval_left_shift(arg, bits - msb - 1);
- res.exponent() -= bits - msb - 1;
+ eval_left_shift(arg, cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - msb - 1);
+ res.exponent() -= cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - msb - 1;
    }
- else if(bits < msb + 1)
+ else if(cpp_bin_float<Digits, DigitBase, Allocator>::bit_count < msb + 1)
    {
- // We have more bits than we need, so round as required,
+ // We have more cpp_bin_float<Digits, DigitBase, Allocator>::bit_count than we need, so round as required,
       // first get the rounding bit:
- bool roundup = eval_bit_test(arg, msb - bits);
+ bool roundup = eval_bit_test(arg, msb - cpp_bin_float<Digits, DigitBase, Allocator>::bit_count);
       // Then check for a tie:
- if(roundup && (msb - bits == eval_lsb(arg)))
+ if(roundup && (msb - cpp_bin_float<Digits, DigitBase, Allocator>::bit_count == eval_lsb(arg)))
       {
          // Ties round towards even:
- if(!eval_bit_test(arg, msb - bits + 1))
+ if(!eval_bit_test(arg, msb - cpp_bin_float<Digits, DigitBase, Allocator>::bit_count + 1))
             roundup = false;
       }
- // Shift off the bits we don't need:
- eval_right_shift(arg, msb - bits + 1);
- res.exponent() += msb - bits + 1;
+ // Shift off the cpp_bin_float<Digits, DigitBase, Allocator>::bit_count we don't need:
+ eval_right_shift(arg, msb - cpp_bin_float<Digits, DigitBase, Allocator>::bit_count + 1);
+ res.exponent() += msb - cpp_bin_float<Digits, DigitBase, Allocator>::bit_count + 1;
       if(roundup)
       {
          eval_increment(arg);
- if(eval_bit_test(arg, bits))
+ if(eval_bit_test(arg, cpp_bin_float<Digits, DigitBase, Allocator>::bit_count))
          {
             // This happens very very rairly:
             eval_right_shift(arg, 1u);
@@ -340,61 +347,61 @@
          }
       }
    }
- BOOST_ASSERT(eval_msb(arg) == bits - 1);
+ BOOST_ASSERT((eval_msb(arg) == cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - 1));
    res.bits() = arg;
 
- if(res.exponent() > cpp_bin_float<bits>::max_exponent)
+ if(res.exponent() > cpp_bin_float<Digits, DigitBase, Allocator>::max_exponent)
    {
       // Overflow:
- res.exponent() = cpp_bin_float<bits>::exponent_infinity;
+ res.exponent() = cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity;
       res.bits() = static_cast<limb_type>(0u);
    }
- else if(res.exponent() < cpp_bin_float<bits>::min_exponent)
+ else if(res.exponent() < cpp_bin_float<Digits, DigitBase, Allocator>::min_exponent)
    {
       // Underflow:
- res.exponent() = cpp_bin_float<bits>::exponent_zero;
+ res.exponent() = cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero;
       res.bits() = static_cast<limb_type>(0u);
       res.sign() = false;
    }
 }
 
-template <unsigned bits>
-inline void do_eval_add(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &a, const cpp_bin_float<bits> &b)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void do_eval_add(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &a, const cpp_bin_float<Digits, DigitBase, Allocator> &b)
 {
    using default_ops::eval_add;
    using default_ops::eval_bit_test;
 
- typename cpp_bin_float<bits>::double_rep_type dt;
+ typename cpp_bin_float<Digits, DigitBase, Allocator>::double_rep_type dt;
 
    // Special cases first:
    switch(a.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
       res = b;
       if(res.sign())
          res.negate();
       return;
- case cpp_bin_float<bits>::exponent_infinity:
- if(b.exponent() == cpp_bin_float<bits>::exponent_nan)
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
+ if(b.exponent() == cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan)
          res = b;
       else
          res = a;
       return; // ault is still infinite.
- case cpp_bin_float<bits>::exponent_nan:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
       res = a;
       return; // ault is still a NaN.
    }
    switch(b.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
       res = a;
       return;
- case cpp_bin_float<bits>::exponent_infinity:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
       res = b;
       if(res.sign())
          res.negate();
       return; // ault is infinite.
- case cpp_bin_float<bits>::exponent_nan:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
       res = b;
       return; // ault is a NaN.
    }
@@ -404,7 +411,7 @@
    if(e_diff >= 0)
    {
       dt = a.bits();
- if(e_diff < bits)
+ if(e_diff < cpp_bin_float<Digits, DigitBase, Allocator>::bit_count)
       {
          eval_left_shift(dt, e_diff);
          res.exponent() = a.exponent() - e_diff;
@@ -416,7 +423,7 @@
    else
    {
       dt= b.bits();
- if(-e_diff < bits)
+ if(-e_diff < cpp_bin_float<Digits, DigitBase, Allocator>::bit_count)
       {
          eval_left_shift(dt, -e_diff);
          res.exponent() = b.exponent() + e_diff;
@@ -432,20 +439,20 @@
       res.negate();
 }
 
-template <unsigned bits>
-inline void do_eval_subtract(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &a, const cpp_bin_float<bits> &b)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void do_eval_subtract(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &a, const cpp_bin_float<Digits, DigitBase, Allocator> &b)
 {
    using default_ops::eval_subtract;
    using default_ops::eval_bit_test;
 
- typename cpp_bin_float<bits>::double_rep_type dt;
+ typename cpp_bin_float<Digits, DigitBase, Allocator>::double_rep_type dt;
    
    // Special cases first:
    switch(a.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
- if(b.exponent() == cpp_bin_float<bits>::exponent_nan)
- res = std::numeric_limits<number<cpp_bin_float<bits> > >::quiet_NaN().backend();
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
+ if(b.exponent() == cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan)
+ res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::quiet_NaN().backend();
       else
       {
          res = b;
@@ -453,27 +460,27 @@
             res.negate();
       }
       return;
- case cpp_bin_float<bits>::exponent_infinity:
- if((b.exponent() == cpp_bin_float<bits>::exponent_nan) || (b.exponent() == cpp_bin_float<bits>::exponent_infinity))
- res = std::numeric_limits<number<cpp_bin_float<bits> > >::quiet_NaN().backend();
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
+ if((b.exponent() == cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan) || (b.exponent() == cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity))
+ res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::quiet_NaN().backend();
       else
          res = a;
       return;
- case cpp_bin_float<bits>::exponent_nan:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
       res = a;
       return; // result is still a NaN.
    }
    switch(b.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
       res = a;
       return;
- case cpp_bin_float<bits>::exponent_infinity:
- res.exponent() = cpp_bin_float<bits>::exponent_nan;
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
+ res.exponent() = cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan;
       res.sign() = false;
       res.bits() = static_cast<limb_type>(0u);
       return; // result is a NaN.
- case cpp_bin_float<bits>::exponent_nan:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
       res = b;
       return; // result is still a NaN.
    }
@@ -483,7 +490,7 @@
    if((e_diff > 0) || ((e_diff == 0) && a.bits().compare(b.bits()) >= 0))
    {
       dt = a.bits();
- if(e_diff < bits)
+ if(e_diff < cpp_bin_float<Digits, DigitBase, Allocator>::bit_count)
       {
          eval_left_shift(dt, e_diff);
          res.exponent() = a.exponent() - e_diff;
@@ -495,7 +502,7 @@
    else
    {
       dt = b.bits();
- if(-e_diff < bits)
+ if(-e_diff < cpp_bin_float<Digits, DigitBase, Allocator>::bit_count)
       {
          eval_left_shift(dt, -e_diff);
          res.exponent() = b.exponent() + e_diff;
@@ -512,8 +519,8 @@
    res.check_invariants();
 }
 
-template <unsigned bits>
-inline void eval_add(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &a, const cpp_bin_float<bits> &b)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_add(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &a, const cpp_bin_float<Digits, DigitBase, Allocator> &b)
 {
    if(a.sign() == b.sign())
       do_eval_add(res, a, b);
@@ -521,14 +528,14 @@
       do_eval_subtract(res, a, b);
 }
 
-template <unsigned bits>
-inline void eval_add(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &a)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_add(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &a)
 {
    return eval_add(res, res, a);
 }
 
-template <unsigned bits>
-inline void eval_subtract(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &a, const cpp_bin_float<bits> &b)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_subtract(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &a, const cpp_bin_float<Digits, DigitBase, Allocator> &b)
 {
    if(a.sign() != b.sign())
       do_eval_add(res, a, b);
@@ -536,14 +543,14 @@
       do_eval_subtract(res, a, b);
 }
 
-template <unsigned bits>
-inline void eval_subtract(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &a)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_subtract(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &a)
 {
    return eval_subtract(res, res, a);
 }
 
-template <unsigned bits>
-inline void eval_multiply(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &a, const cpp_bin_float<bits> &b)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_multiply(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &a, const cpp_bin_float<Digits, DigitBase, Allocator> &b)
 {
    using default_ops::eval_bit_test;
    using default_ops::eval_multiply;
@@ -551,19 +558,19 @@
    // Special cases first:
    switch(a.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
- if(b.exponent() == cpp_bin_float<bits>::exponent_nan)
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
+ if(b.exponent() == cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan)
          res = b;
       else
          res = a;
       return;
- case cpp_bin_float<bits>::exponent_infinity:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
       switch(b.exponent())
       {
- case cpp_bin_float<bits>::exponent_zero:
- res = std::numeric_limits<number<cpp_bin_float<bits> > >::quiet_NaN().backend();
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
+ res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::quiet_NaN().backend();
          break;
- case cpp_bin_float<bits>::exponent_nan:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
          res = b;
          break;
       default:
@@ -571,21 +578,21 @@
          break;
       }
       return;
- case cpp_bin_float<bits>::exponent_nan:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
       res = a;
       return;
    }
- if(b.exponent() > cpp_bin_float<bits>::max_exponent)
+ if(b.exponent() > cpp_bin_float<Digits, DigitBase, Allocator>::max_exponent)
    {
       res = b;
       return;
    }
    if((a.exponent() > 0) && (b.exponent() > 0))
    {
- if(cpp_bin_float<bits>::max_exponent + 2 - a.exponent() < b.exponent())
+ if(cpp_bin_float<Digits, DigitBase, Allocator>::max_exponent + 2 - a.exponent() < b.exponent())
       {
          // We will certainly overflow:
- res.exponent() = cpp_bin_float<bits>::exponent_infinity;
+ res.exponent() = cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity;
          res.sign() = a.sign() != b.sign();
          res.bits() = static_cast<limb_type>(0u);
          return;
@@ -593,32 +600,32 @@
    }
    if((a.exponent() < 0) && (b.exponent() < 0))
    {
- if(cpp_bin_float<bits>::min_exponent - 2 - a.exponent() > b.exponent())
+ if(cpp_bin_float<Digits, DigitBase, Allocator>::min_exponent - 2 - a.exponent() > b.exponent())
       {
          // We will certainly underflow:
- res.exponent() = cpp_bin_float<bits>::exponent_zero;
+ res.exponent() = cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero;
          res.sign() = false;
          res.bits() = static_cast<limb_type>(0u);
          return;
       }
    }
 
- typename cpp_bin_float<bits>::double_rep_type dt;
+ typename cpp_bin_float<Digits, DigitBase, Allocator>::double_rep_type dt;
    eval_multiply(dt, a.bits(), b.bits());
- res.exponent() = a.exponent() + b.exponent() - bits + 1;
+ res.exponent() = a.exponent() + b.exponent() - cpp_bin_float<Digits, DigitBase, Allocator>::bit_count + 1;
    copy_and_round(res, dt);
    res.check_invariants();
    res.sign() = a.sign() != b.sign();
 }
 
-template <unsigned bits>
-inline void eval_multiply(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &a)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_multiply(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &a)
 {
    eval_multiply(res, res, a);
 }
 
-template <unsigned bits, class U>
-inline typename enable_if_c<is_unsigned<U>::value>::type eval_multiply(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &a, const U &b)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator, class U>
+inline typename enable_if_c<is_unsigned<U>::value>::type eval_multiply(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &a, const U &b)
 {
    using default_ops::eval_bit_test;
    using default_ops::eval_multiply;
@@ -626,22 +633,22 @@
    // Special cases first:
    switch(a.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
       res = a;
       return;
- case cpp_bin_float<bits>::exponent_infinity:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
       if(b == 0)
- res = std::numeric_limits<number<cpp_bin_float<bits> > >::quiet_NaN().backend();
+ res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::quiet_NaN().backend();
       else
          res = a;
       return;
- case cpp_bin_float<bits>::exponent_nan:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
       res = a;
       return;
    }
 
- typename cpp_bin_float<bits>::double_rep_type dt;
- typedef typename boost::multiprecision::detail::canonical<U, typename cpp_bin_float<bits>::double_rep_type>::type canon_ui_type;
+ typename cpp_bin_float<Digits, DigitBase, Allocator>::double_rep_type dt;
+ typedef typename boost::multiprecision::detail::canonical<U, typename cpp_bin_float<Digits, DigitBase, Allocator>::double_rep_type>::type canon_ui_type;
    eval_multiply(dt, a.bits(), static_cast<canon_ui_type>(b));
    res.exponent() = a.exponent();
    copy_and_round(res, dt);
@@ -649,14 +656,14 @@
    res.sign() = a.sign();
 }
 
-template <unsigned bits, class U>
-inline typename enable_if_c<is_unsigned<U>::value>::type eval_multiply(cpp_bin_float<bits> &res, const U &b)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator, class U>
+inline typename enable_if_c<is_unsigned<U>::value>::type eval_multiply(cpp_bin_float<Digits, DigitBase, Allocator> &res, const U &b)
 {
    eval_multiply(res, res, b);
 }
 
-template <unsigned bits, class S>
-inline typename enable_if_c<is_signed<S>::value>::type eval_multiply(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &a, const S &b)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator, class S>
+inline typename enable_if_c<is_signed<S>::value>::type eval_multiply(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &a, const S &b)
 {
    typedef typename make_unsigned<S>::type ui_type;
    eval_multiply(res, a, static_cast<ui_type>(boost::multiprecision::detail::abs(b)));
@@ -664,14 +671,14 @@
       res.negate();
 }
 
-template <unsigned bits, class S>
-inline typename enable_if_c<is_signed<S>::value>::type eval_multiply(cpp_bin_float<bits> &res, const S &b)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator, class S>
+inline typename enable_if_c<is_signed<S>::value>::type eval_multiply(cpp_bin_float<Digits, DigitBase, Allocator> &res, const S &b)
 {
    eval_multiply(res, res, b);
 }
 
-template <unsigned bits>
-inline void eval_divide(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &u, const cpp_bin_float<bits> &v)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_divide(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &u, const cpp_bin_float<Digits, DigitBase, Allocator> &v)
 {
    using default_ops::eval_subtract;
    using default_ops::eval_qr;
@@ -683,46 +690,46 @@
    //
    switch(u.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
       switch(v.exponent())
       {
- case cpp_bin_float<bits>::exponent_zero:
- case cpp_bin_float<bits>::exponent_nan:
- res = std::numeric_limits<number<cpp_bin_float<bits> > >::quiet_NaN().backend();
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
+ res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::quiet_NaN().backend();
          return;
       }
       res = u;
       return;
- case cpp_bin_float<bits>::exponent_infinity:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
       switch(v.exponent())
       {
- case cpp_bin_float<bits>::exponent_infinity:
- case cpp_bin_float<bits>::exponent_nan:
- res = std::numeric_limits<number<cpp_bin_float<bits> > >::quiet_NaN().backend();
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
+ res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::quiet_NaN().backend();
          return;
       }
       res = u;
       return;
- case cpp_bin_float<bits>::exponent_nan:
- res = std::numeric_limits<number<cpp_bin_float<bits> > >::quiet_NaN().backend();
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
+ res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::quiet_NaN().backend();
       return;
    }
    switch(v.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
       {
       bool s = u.sign() != v.sign();
- res = std::numeric_limits<number<cpp_bin_float<bits> > >::infinity().backend();
+ res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::infinity().backend();
       res.sign() = s;
       return;
       }
- case cpp_bin_float<bits>::exponent_infinity:
- res.exponent() = cpp_bin_float<bits>::exponent_zero;
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
+ res.exponent() = cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero;
       res.bits() = limb_type(0);
       res.sign() = false;
       return;
- case cpp_bin_float<bits>::exponent_nan:
- res = std::numeric_limits<number<cpp_bin_float<bits> > >::quiet_NaN().backend();
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
+ res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::quiet_NaN().backend();
       return;
    }
 
@@ -735,7 +742,7 @@
    //
    // q + r/v = u/v
    //
- // From this, assuming q has "bits" bits, we only need to determine whether
+ // From this, assuming q has "cpp_bin_float<Digits, DigitBase, Allocator>::bit_count" cpp_bin_float<Digits, DigitBase, Allocator>::bit_count, we only need to determine whether
    // r/v is less than, equal to, or greater than 0.5 to determine rounding -
    // this we can do with a shift and comparison.
    //
@@ -746,21 +753,21 @@
    //
    // Now get the quotient and remainder:
    //
- typename cpp_bin_float<bits>::double_rep_type t(u.bits()), t2(v.bits()), q, r;
- eval_left_shift(t, bits);
+ typename cpp_bin_float<Digits, DigitBase, Allocator>::double_rep_type t(u.bits()), t2(v.bits()), q, r;
+ eval_left_shift(t, cpp_bin_float<Digits, DigitBase, Allocator>::bit_count);
    eval_qr(t, t2, q, r);
    //
- // We now have either "bits" or "bits+1" significant bits in q.
+ // We now have either "cpp_bin_float<Digits, DigitBase, Allocator>::bit_count" or "cpp_bin_float<Digits, DigitBase, Allocator>::bit_count+1" significant cpp_bin_float<Digits, DigitBase, Allocator>::bit_count in q.
    //
    static const unsigned limb_bits = sizeof(limb_type) * CHAR_BIT;
- if(eval_bit_test(q, bits))
+ if(eval_bit_test(q, cpp_bin_float<Digits, DigitBase, Allocator>::bit_count))
    {
       //
- // OK we have bits+1 bits, so we already have rounding info,
+ // OK we have cpp_bin_float<Digits, DigitBase, Allocator>::bit_count+1 cpp_bin_float<Digits, DigitBase, Allocator>::bit_count, so we already have rounding info,
       // we just need to changes things if the last bit is 1 and the
       // remainder is non-zero (ie we do not have a tie).
       //
- BOOST_ASSERT(eval_msb(q) == bits);
+ BOOST_ASSERT((eval_msb(q) == cpp_bin_float<Digits, DigitBase, Allocator>::bit_count));
       if((q.limbs()[0] & 1u) && eval_get_sign(r))
       {
          eval_left_shift(q, limb_bits);
@@ -771,13 +778,13 @@
    else
    {
       //
- // We have exactly "bits" bits in q.
+ // We have exactly "cpp_bin_float<Digits, DigitBase, Allocator>::bit_count" cpp_bin_float<Digits, DigitBase, Allocator>::bit_count in q.
       // Get rounding info, which we can get by comparing 2r with v.
       // We want to call copy_and_round to handle rounding and general cleanup,
- // so we'll left shift q and add some fake bits on the end to represent
+ // so we'll left shift q and add some fake cpp_bin_float<Digits, DigitBase, Allocator>::bit_count on the end to represent
       // how we'll be rounding.
       //
- BOOST_ASSERT(eval_msb(q) == bits - 1);
+ BOOST_ASSERT((eval_msb(q) == cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - 1));
       eval_left_shift(q, limb_bits);
       res.exponent() -= limb_bits;
       eval_left_shift(r, 1u);
@@ -790,14 +797,14 @@
    copy_and_round(res, q);
 }
 
-template <unsigned bits>
-inline void eval_divide(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &arg)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_divide(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &arg)
 {
    eval_divide(res, res, arg);
 }
 
-template <unsigned bits, class U>
-inline typename enable_if_c<is_unsigned<U>::value>::type eval_divide(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &u, const U &v)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator, class U>
+inline typename enable_if_c<is_unsigned<U>::value>::type eval_divide(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &u, const U &v)
 {
    using default_ops::eval_subtract;
    using default_ops::eval_qr;
@@ -809,25 +816,25 @@
    //
    switch(u.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
       if(v == 0)
       {
- res = std::numeric_limits<number<cpp_bin_float<bits> > >::quiet_NaN().backend();
+ res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::quiet_NaN().backend();
          return;
       }
       res = u;
       return;
- case cpp_bin_float<bits>::exponent_infinity:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
       res = u;
       return;
- case cpp_bin_float<bits>::exponent_nan:
- res = std::numeric_limits<number<cpp_bin_float<bits> > >::quiet_NaN().backend();
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
+ res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::quiet_NaN().backend();
       return;
    }
    if(v == 0)
    {
       bool s = u.sign();
- res = std::numeric_limits<number<cpp_bin_float<bits> > >::infinity().backend();
+ res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::infinity().backend();
       res.sign() = s;
       return;
    }
@@ -841,7 +848,7 @@
    //
    // q + r/v = u/v
    //
- // From this, assuming q has "bits" bits, we only need to determine whether
+ // From this, assuming q has "cpp_bin_float<Digits, DigitBase, Allocator>::bit_count" cpp_bin_float<Digits, DigitBase, Allocator>::bit_count, we only need to determine whether
    // r/v is less than, equal to, or greater than 0.5 to determine rounding -
    // this we can do with a shift and comparison.
    //
@@ -853,21 +860,21 @@
    //
    // Now get the quotient and remainder:
    //
- typename cpp_bin_float<bits>::double_rep_type t(u.bits()), q, r;
+ typename cpp_bin_float<Digits, DigitBase, Allocator>::double_rep_type t(u.bits()), q, r;
    eval_left_shift(t, gb + 1);
- eval_qr(t, number<typename cpp_bin_float<bits>::double_rep_type>::canonical_value(v), q, r);
+ eval_qr(t, number<typename cpp_bin_float<Digits, DigitBase, Allocator>::double_rep_type>::canonical_value(v), q, r);
    //
- // We now have either "bits" or "bits+1" significant bits in q.
+ // We now have either "cpp_bin_float<Digits, DigitBase, Allocator>::bit_count" or "cpp_bin_float<Digits, DigitBase, Allocator>::bit_count+1" significant cpp_bin_float<Digits, DigitBase, Allocator>::bit_count in q.
    //
    static const unsigned limb_bits = sizeof(limb_type) * CHAR_BIT;
- if(eval_bit_test(q, bits))
+ if(eval_bit_test(q, cpp_bin_float<Digits, DigitBase, Allocator>::bit_count))
    {
       //
- // OK we have bits+1 bits, so we already have rounding info,
+ // OK we have cpp_bin_float<Digits, DigitBase, Allocator>::bit_count+1 cpp_bin_float<Digits, DigitBase, Allocator>::bit_count, so we already have rounding info,
       // we just need to changes things if the last bit is 1 and the
       // remainder is non-zero (ie we do not have a tie).
       //
- BOOST_ASSERT(eval_msb(q) == bits);
+ BOOST_ASSERT((eval_msb(q) == cpp_bin_float<Digits, DigitBase, Allocator>::bit_count));
       if((q.limbs()[0] & 1u) && eval_get_sign(r))
       {
          eval_left_shift(q, limb_bits);
@@ -878,17 +885,17 @@
    else
    {
       //
- // We have exactly "bits" bits in q.
+ // We have exactly "cpp_bin_float<Digits, DigitBase, Allocator>::bit_count" cpp_bin_float<Digits, DigitBase, Allocator>::bit_count in q.
       // Get rounding info, which we can get by comparing 2r with v.
       // We want to call copy_and_round to handle rounding and general cleanup,
- // so we'll left shift q and add some fake bits on the end to represent
+ // so we'll left shift q and add some fake cpp_bin_float<Digits, DigitBase, Allocator>::bit_count on the end to represent
       // how we'll be rounding.
       //
- BOOST_ASSERT(eval_msb(q) == bits - 1);
+ BOOST_ASSERT((eval_msb(q) == cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - 1));
       eval_left_shift(q, limb_bits);
       res.exponent() -= limb_bits;
       eval_left_shift(r, 1u);
- int c = r.compare(number<typename cpp_bin_float<bits>::double_rep_type>::canonical_value(v));
+ int c = r.compare(number<typename cpp_bin_float<Digits, DigitBase, Allocator>::double_rep_type>::canonical_value(v));
       if(c == 0)
          q.limbs()[0] = static_cast<limb_type>(1u) << (limb_bits - 1);
       else if(c > 0)
@@ -897,14 +904,14 @@
    copy_and_round(res, q);
 }
 
-template <unsigned bits, class U>
-inline typename enable_if_c<is_unsigned<U>::value>::type eval_divide(cpp_bin_float<bits> &res, const U &v)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator, class U>
+inline typename enable_if_c<is_unsigned<U>::value>::type eval_divide(cpp_bin_float<Digits, DigitBase, Allocator> &res, const U &v)
 {
    eval_divide(res, res, v);
 }
 
-template <unsigned bits, class S>
-inline typename enable_if_c<is_signed<S>::value>::type eval_divide(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &u, const S &v)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator, class S>
+inline typename enable_if_c<is_signed<S>::value>::type eval_divide(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &u, const S &v)
 {
    typedef typename make_unsigned<S>::type ui_type;
    eval_divide(res, u, static_cast<ui_type>(boost::multiprecision::detail::abs(v)));
@@ -912,38 +919,38 @@
       res.negate();
 }
 
-template <unsigned bits, class S>
-inline typename enable_if_c<is_signed<S>::value>::type eval_divide(cpp_bin_float<bits> &res, const S &v)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator, class S>
+inline typename enable_if_c<is_signed<S>::value>::type eval_divide(cpp_bin_float<Digits, DigitBase, Allocator> &res, const S &v)
 {
    eval_divide(res, res, v);
 }
 
-template <unsigned bits>
-inline void eval_convert_to(long long *res, const cpp_bin_float<bits> &arg)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_convert_to(long long *res, const cpp_bin_float<Digits, DigitBase, Allocator> &arg)
 {
    switch(arg.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
       *res = 0;
       return;
- case cpp_bin_float<bits>::exponent_nan:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
       BOOST_THROW_EXCEPTION(std::runtime_error("Could not convert NaN to integer."));
- case cpp_bin_float<bits>::exponent_infinity:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
       *res = (std::numeric_limits<long long>::max)();
       if(arg.sign())
          *res = -*res;
       return;
    }
- typename cpp_bin_float<bits>::rep_type man(arg.bits());
- int shift = bits - 1 - arg.exponent();
- if(shift > bits - 1)
+ typename cpp_bin_float<Digits, DigitBase, Allocator>::rep_type man(arg.bits());
+ int shift = cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - 1 - arg.exponent();
+ if(shift > cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - 1)
    {
       *res = 0;
       return;
    }
    else if(shift < 0)
    {
- // TODO: what if we have fewer bits than a long long?
+ // TODO: what if we have fewer cpp_bin_float<Digits, DigitBase, Allocator>::bit_count than a long long?
       *res = (std::numeric_limits<long long>::max)();
       if(arg.sign())
          *res = -*res;
@@ -955,30 +962,30 @@
       *res = -*res;
 }
 
-template <unsigned bits>
-inline void eval_convert_to(unsigned long long *res, const cpp_bin_float<bits> &arg)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_convert_to(unsigned long long *res, const cpp_bin_float<Digits, DigitBase, Allocator> &arg)
 {
    switch(arg.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
       *res = 0;
       return;
- case cpp_bin_float<bits>::exponent_nan:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
       BOOST_THROW_EXCEPTION(std::runtime_error("Could not convert NaN to integer."));
- case cpp_bin_float<bits>::exponent_infinity:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
       *res = (std::numeric_limits<unsigned long long>::max)();
       return;
    }
- typename cpp_bin_float<bits>::rep_type man(arg.bits());
- int shift = bits - 1 - arg.exponent();
- if(shift > bits - 1)
+ typename cpp_bin_float<Digits, DigitBase, Allocator>::rep_type man(arg.bits());
+ int shift = cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - 1 - arg.exponent();
+ if(shift > cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - 1)
    {
       *res = 0;
       return;
    }
    else if(shift < 0)
    {
- // TODO: what if we have fewer bits than a long long?
+ // TODO: what if we have fewer cpp_bin_float<Digits, DigitBase, Allocator>::bit_count than a long long?
       *res = (std::numeric_limits<long long>::max)();
       return;
    }
@@ -986,39 +993,39 @@
    eval_convert_to(res, man);
 }
 
-template <unsigned bits>
-inline void eval_convert_to(long double *res, const cpp_bin_float<bits> &arg)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_convert_to(long double *res, const cpp_bin_float<Digits, DigitBase, Allocator> &arg)
 {
    switch(arg.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
       *res = 0;
       return;
- case cpp_bin_float<bits>::exponent_nan:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
       *res = std::numeric_limits<long double>::quiet_NaN();
       return;
- case cpp_bin_float<bits>::exponent_infinity:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
       *res = (std::numeric_limits<long double>::infinity)();
       if(arg.sign())
          *res = -*res;
       return;
    }
    int e = arg.exponent();
- e -= bits - 1;
+ e -= cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - 1;
    eval_convert_to(res, arg.bits());
    *res = std::ldexp(*res, e);
    if(arg.sign())
       *res = -*res;
 }
 
-template <unsigned bits>
-inline void eval_frexp(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &arg, int *e)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_frexp(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &arg, int *e)
 {
    switch(arg.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
- case cpp_bin_float<bits>::exponent_nan:
- case cpp_bin_float<bits>::exponent_infinity:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
       *e = 0;
       res = arg;
       return;
@@ -1028,14 +1035,14 @@
    res.exponent() = -1;
 }
 
-template <unsigned bits>
-inline void eval_ldexp(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &arg, int e)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_ldexp(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &arg, int e)
 {
    switch(arg.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
- case cpp_bin_float<bits>::exponent_nan:
- case cpp_bin_float<bits>::exponent_infinity:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
       res = arg;
       return;
    }
@@ -1047,62 +1054,62 @@
 * Sign manipulation
 */
 
-template <unsigned bits>
-inline void eval_abs(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &arg)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_abs(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &arg)
 {
    res = arg;
    res.sign() = false;
 }
 
-template <unsigned bits>
-inline void eval_fabs(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &arg)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_fabs(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &arg)
 {
    res = arg;
    res.sign() = false;
 }
 
-template <unsigned bits>
-inline int eval_fpclassify(const cpp_bin_float<bits> &arg)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline int eval_fpclassify(const cpp_bin_float<Digits, DigitBase, Allocator> &arg)
 {
    switch(arg.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
       return FP_ZERO;
- case cpp_bin_float<bits>::exponent_infinity:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
       return FP_INFINITE;
- case cpp_bin_float<bits>::exponent_nan:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
       return FP_NAN;
    }
    return FP_NORMAL;
 }
 
-template <unsigned bits>
-inline void eval_sqrt(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &arg)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_sqrt(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &arg)
 {
    using default_ops::eval_integer_sqrt;
    switch(arg.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
- case cpp_bin_float<bits>::exponent_nan:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
       res = arg;
       return;
- case cpp_bin_float<bits>::exponent_infinity:
- res = std::numeric_limits<number<cpp_bin_float<bits> > >::quiet_NaN().backend();
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
+ res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::quiet_NaN().backend();
       return;
    }
    if(arg.sign())
    {
- res = std::numeric_limits<number<cpp_bin_float<bits> > >::quiet_NaN().backend();
+ res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::quiet_NaN().backend();
       return;
    }
 
- typename cpp_bin_float<bits>::double_rep_type t(arg.bits()), r, s;
- eval_left_shift(t, arg.exponent() & 1 ? bits : bits - 1);
+ typename cpp_bin_float<Digits, DigitBase, Allocator>::double_rep_type t(arg.bits()), r, s;
+ eval_left_shift(t, arg.exponent() & 1 ? cpp_bin_float<Digits, DigitBase, Allocator>::bit_count : cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - 1);
    eval_integer_sqrt(s, r, t);
 
- if(!eval_bit_test(s, bits))
+ if(!eval_bit_test(s, cpp_bin_float<Digits, DigitBase, Allocator>::bit_count))
    {
- // We have exactly the right number of bits in the result, round as required:
+ // We have exactly the right number of cpp_bin_float<Digits, DigitBase, Allocator>::bit_count in the result, round as required:
       if(s.compare(r) < 0)
       {
          eval_increment(s);
@@ -1115,26 +1122,26 @@
    copy_and_round(res, s);
 }
 
-template <unsigned bits>
-inline void eval_floor(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &arg)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_floor(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &arg)
 {
    using default_ops::eval_increment;
    switch(arg.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
- case cpp_bin_float<bits>::exponent_nan:
- case cpp_bin_float<bits>::exponent_infinity:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
       res = arg;
       return;
    }
- int shift = (int)bits - arg.exponent() - 1;
- if((arg.exponent() > cpp_bin_float<bits>::max_exponent) || (shift <= 0))
+ int shift = (int)cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - arg.exponent() - 1;
+ if((arg.exponent() > cpp_bin_float<Digits, DigitBase, Allocator>::max_exponent) || (shift <= 0))
    {
       // Either arg is already an integer, or a special value:
       res = arg;
       return;
    }
- if(shift >= bits)
+ if(shift >= cpp_bin_float<Digits, DigitBase, Allocator>::bit_count)
    {
       res = arg.sign() ? -1 : 0;
       return;
@@ -1145,7 +1152,7 @@
    if(fractional && res.sign())
    {
       eval_increment(res.bits());
- if(eval_msb(res.bits()) != bits - 1 - shift)
+ if(eval_msb(res.bits()) != cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - 1 - shift)
       {
          // Must have extended result by one bit in the increment:
          --shift;
@@ -1155,26 +1162,26 @@
    eval_left_shift(res.bits(), shift);
 }
 
-template <unsigned bits>
-inline void eval_ceil(cpp_bin_float<bits> &res, const cpp_bin_float<bits> &arg)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+inline void eval_ceil(cpp_bin_float<Digits, DigitBase, Allocator> &res, const cpp_bin_float<Digits, DigitBase, Allocator> &arg)
 {
    using default_ops::eval_increment;
    switch(arg.exponent())
    {
- case cpp_bin_float<bits>::exponent_zero:
- case cpp_bin_float<bits>::exponent_nan:
- case cpp_bin_float<bits>::exponent_infinity:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_zero:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_nan:
+ case cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity:
       res = arg;
       return;
    }
- int shift = (int)bits - arg.exponent() - 1;
- if((arg.exponent() > cpp_bin_float<bits>::max_exponent) || (shift <= 0))
+ int shift = (int)cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - arg.exponent() - 1;
+ if((arg.exponent() > cpp_bin_float<Digits, DigitBase, Allocator>::max_exponent) || (shift <= 0))
    {
       // Either arg is already an integer, or a special value:
       res = arg;
       return;
    }
- if(shift >= bits)
+ if(shift >= cpp_bin_float<Digits, DigitBase, Allocator>::bit_count)
    {
       res = arg.sign() ? 0 : 1;
       return;
@@ -1185,7 +1192,7 @@
    if(fractional && !res.sign())
    {
       eval_increment(res.bits());
- if(eval_msb(res.bits()) != bits - 1 - shift)
+ if(eval_msb(res.bits()) != cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - 1 - shift)
       {
          // Must have extended result by one bit in the increment:
          --shift;
@@ -1198,11 +1205,16 @@
 } // namespace backends
 
 using backends::cpp_bin_float;
+using backends::digit_base_2;
+using backends::digit_base_10;
+
+template<unsigned Digits, backends::digit_base_type DigitBase, class Allocator>
+struct number_category<cpp_bin_float<Digits, DigitBase, Allocator> > : public boost::mpl::int_<boost::multiprecision::number_kind_floating_point>{};
 
-template<unsigned bits>
-struct number_category<cpp_bin_float<bits> > : public boost::mpl::int_<boost::multiprecision::number_kind_floating_point>{};
+typedef number<backends::cpp_bin_float<113, digit_base_2>, et_off> bin_float128;
 
-typedef number<backends::cpp_bin_float<113>, et_off> bin_float128;
+typedef number<backends::cpp_bin_float<50>, et_off> cpp_bin_float_50;
+typedef number<backends::cpp_bin_float<50>, et_off> cpp_bin_float_100;
 
 }} // namespaces
 
@@ -1213,10 +1225,10 @@
 //
 // numeric_limits [partial] specializations for the types declared in this header:
 //
-template<unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-class numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >
+template<unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+class numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >
 {
- typedef boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> number_type;
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> number_type;
 public:
    BOOST_STATIC_CONSTEXPR bool is_specialized = true;
    static number_type (min)()
@@ -1227,7 +1239,7 @@
       {
          value.first = true;
          value.second = 1u;
- value.second.backend().exponent() = boost::multiprecision::cpp_bin_float<bits>::min_exponent;
+ value.second.backend().exponent() = boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>::min_exponent;
       }
       return value.second;
    }
@@ -1239,7 +1251,7 @@
       {
          value.first = true;
          eval_complement(value.second.backend().bits(), value.second.backend().bits());
- value.second.backend().exponent() = boost::multiprecision::cpp_bin_float<bits>::max_exponent;
+ value.second.backend().exponent() = boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>::max_exponent;
       }
       return value.second;
    }
@@ -1247,8 +1259,8 @@
    {
       return -(max)();
    }
- BOOST_STATIC_CONSTEXPR int digits = bits;
- BOOST_STATIC_CONSTEXPR int digits10 = bits * 301 / 1000;
+ BOOST_STATIC_CONSTEXPR int digits = boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>::bit_count;
+ BOOST_STATIC_CONSTEXPR int digits10 = digits * 301 / 1000;
    // Is this really correct???
    BOOST_STATIC_CONSTEXPR int max_digits10 = digits10 + 2;
    BOOST_STATIC_CONSTEXPR bool is_signed = true;
@@ -1263,7 +1275,7 @@
       {
          value.first = true;
          value.second = 1;
- value.second = ldexp(value.second, 1 - (int)bits);
+ value.second = ldexp(value.second, 1 - (int)digits);
       }
       return value.second;
    }
@@ -1281,9 +1293,9 @@
       }
       return value.second;
    }
- BOOST_STATIC_CONSTEXPR long min_exponent = boost::multiprecision::cpp_bin_float<bits>::min_exponent;
+ BOOST_STATIC_CONSTEXPR long min_exponent = boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>::min_exponent;
    BOOST_STATIC_CONSTEXPR long min_exponent10 = (min_exponent / 1000) * 301L;
- BOOST_STATIC_CONSTEXPR long max_exponent = boost::multiprecision::cpp_bin_float<bits>::max_exponent;
+ BOOST_STATIC_CONSTEXPR long max_exponent = boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>::max_exponent;
    BOOST_STATIC_CONSTEXPR long max_exponent10 = (max_exponent / 1000) * 301L;
    BOOST_STATIC_CONSTEXPR bool has_infinity = true;
    BOOST_STATIC_CONSTEXPR bool has_quiet_NaN = true;
@@ -1298,7 +1310,7 @@
       if(!value.first)
       {
          value.first = true;
- value.second.backend().exponent() = boost::multiprecision::cpp_bin_float<bits>::exponent_infinity;
+ value.second.backend().exponent() = boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>::exponent_infinity;
       }
       return value.second;
    }
@@ -1322,67 +1334,67 @@
    {
       data_initializer()
       {
- std::numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits> > >::epsilon();
- std::numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits> > >::round_error();
- (std::numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits> > >::min)();
- (std::numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits> > >::max)();
- std::numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits> > >::infinity();
- std::numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits> > >::quiet_NaN();
+ std::numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator> > >::epsilon();
+ std::numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator> > >::round_error();
+ (std::numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator> > >::min)();
+ (std::numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator> > >::max)();
+ std::numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator> > >::infinity();
+ std::numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator> > >::quiet_NaN();
       }
       void do_nothing()const{}
    };
    static const data_initializer initializer;
 };
 
-template<unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-const typename numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::data_initializer numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::initializer;
+template<unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+const typename numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::data_initializer numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::initializer;
 
 #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
 
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::digits;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::digits10;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::max_digits10;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::is_signed;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::is_integer;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::is_exact;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::radix;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST long numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::min_exponent;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST long numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::min_exponent10;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST long numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::max_exponent;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST long numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::max_exponent10;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::has_infinity;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::has_quiet_NaN;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::has_signaling_NaN;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST float_denorm_style numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::has_denorm;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::has_denorm_loss;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::is_iec559;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::is_bounded;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::is_modulo;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::traps;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::tinyness_before;
-template <unsigned bits, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST float_round_style numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<bits>, ExpressionTemplates> >::round_style;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::digits;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::digits10;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::max_digits10;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::is_signed;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::is_integer;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::is_exact;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::radix;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST long numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::min_exponent;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST long numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::min_exponent10;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST long numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::max_exponent;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST long numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::max_exponent10;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::has_infinity;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::has_quiet_NaN;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::has_signaling_NaN;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST float_denorm_style numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::has_denorm;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::has_denorm_loss;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::is_iec559;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::is_bounded;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::is_modulo;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::traps;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::tinyness_before;
+template <unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST float_round_style numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator>, ExpressionTemplates> >::round_style;
 
 #endif
 

Modified: sandbox/multiprecision.cpp_bin_float/boost/multiprecision/cpp_bin_float/io.hpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/boost/multiprecision/cpp_bin_float/io.hpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/boost/multiprecision/cpp_bin_float/io.hpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -155,13 +155,13 @@
 
 namespace backends{
 
-template <unsigned Bits>
-cpp_bin_float<Bits>& cpp_bin_float<Bits>::operator=(const char *s)
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+cpp_bin_float<Digits, DigitBase, Allocator>& cpp_bin_float<Digits, DigitBase, Allocator>::operator=(const char *s)
 {
    cpp_int n;
    int decimal_exp = 0;
    int digits_seen = 0;
- static const int max_digits_seen = 4 + (Bits * 301L) / 1000;
+ static const int max_digits_seen = 4 + (cpp_bin_float<Digits, DigitBase, Allocator>::bit_count * 301L) / 1000;
    bool ss = false;
    //
    // Extract the sign:
@@ -178,11 +178,11 @@
    //
    if((std::strcmp(s, "nan") == 0) || (std::strcmp(s, "NaN") == 0) || (std::strcmp(s, "NAN") == 0))
    {
- return *this = std::numeric_limits<number<cpp_bin_float<Bits> > >::quiet_NaN().backend();
+ return *this = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::quiet_NaN().backend();
    }
    if((std::strcmp(s, "inf") == 0) || (std::strcmp(s, "Inf") == 0) || (std::strcmp(s, "INF") == 0) || (std::strcmp(s, "infinity") == 0) || (std::strcmp(s, "Infinity") == 0) || (std::strcmp(s, "INFINITY") == 0))
    {
- *this = std::numeric_limits<number<cpp_bin_float<Bits> > >::infinity().backend();
+ *this = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::infinity().backend();
       if(ss)
          negate();
       return *this;
@@ -262,19 +262,19 @@
    static const unsigned limb_bits = sizeof(limb_type) * CHAR_BIT;
    //
    // Set our working precision - this is heuristic based, we want
- // a value as small as possible > Bits to avoid large computations
+ // a value as small as possible > cpp_bin_float<Digits, DigitBase, Allocator>::bit_count to avoid large computations
    // and excessive memory usage, but we also want to avoid having to
    // up the computation and start again at a higher precision.
- // So we round Bits up to the nearest whole number of limbs, and add
+ // So we round cpp_bin_float<Digits, DigitBase, Allocator>::bit_count up to the nearest whole number of limbs, and add
    // one limb for good measure. This works very well for small exponents,
    // but for larger exponents we may may need to restart, we could add some
    // extra precision right from the start for larger exponents, but this
    // seems to be slightly slower in the *average* case:
    //
 #ifdef BOOST_MP_STRESS_IO
- int max_bits = Bits + 32;
+ int max_bits = cpp_bin_float<Digits, DigitBase, Allocator>::bit_count + 32;
 #else
- int max_bits = Bits + (Bits % limb_bits ? limb_bits - Bits % limb_bits : 0) + limb_bits;
+ int max_bits = cpp_bin_float<Digits, DigitBase, Allocator>::bit_count + (cpp_bin_float<Digits, DigitBase, Allocator>::bit_count % limb_bits ? limb_bits - cpp_bin_float<Digits, DigitBase, Allocator>::bit_count % limb_bits : 0) + limb_bits;
 #endif
    boost::int64_t error = 0;
    int calc_exp = 0;
@@ -292,10 +292,10 @@
          }
          else
             t = n;
- exponent() = (int)Bits - 1;
+ exponent() = (int)cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - 1;
          exponent() += decimal_exp;
          exponent() += calc_exp;
- int rshift = msb(t) - Bits + 1;
+ int rshift = msb(t) - cpp_bin_float<Digits, DigitBase, Allocator>::bit_count + 1;
          if(rshift > 0)
          {
             exponent() += rshift;
@@ -336,8 +336,8 @@
       {
          cpp_int d;
          calc_exp = boost::multiprecision::cpp_bf_io_detail::restricted_pow(d, cpp_int(5), -decimal_exp, max_bits, error);
- int shift = (int)Bits - msb(n) + msb(d);
- exponent() = Bits - 1 + decimal_exp - calc_exp;
+ int shift = (int)cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - msb(n) + msb(d);
+ exponent() = cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - 1 + decimal_exp - calc_exp;
          if(shift > 0)
          {
             n <<= shift;
@@ -346,25 +346,25 @@
          cpp_int q, r;
          divide_qr(n, d, q, r);
          int gb = msb(q);
- BOOST_ASSERT(gb >= Bits - 1);
+ BOOST_ASSERT((gb >= cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - 1));
          //
          // Check for rounding conditions we have to
          // handle ourselves:
          //
          int roundup = 0;
- if(gb == Bits - 1)
+ if(gb == cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - 1)
          {
             // Exactly the right number of bits, use the remainder to round:
             roundup = boost::multiprecision::cpp_bf_io_detail::get_round_mode(r, d, error, q);
          }
- else if(bit_test(q, gb - (int)Bits) && ((int)lsb(q) == (gb - (int)Bits)))
+ else if(bit_test(q, gb - (int)cpp_bin_float<Digits, DigitBase, Allocator>::bit_count) && ((int)lsb(q) == (gb - (int)cpp_bin_float<Digits, DigitBase, Allocator>::bit_count)))
          {
             // Too many bits in q and the bits in q indicate a tie, but we can break that using r,
             // note that the radius of error in r is error/2 * q:
- int shift = gb - (int)Bits + 1;
+ int shift = gb - (int)cpp_bin_float<Digits, DigitBase, Allocator>::bit_count + 1;
             q >>= shift;
             exponent() += shift;
- BOOST_ASSERT(msb(q) >= Bits - 1);
+ BOOST_ASSERT((msb(q) >= cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - 1));
             if(error && (r < (error / 2) * q))
                roundup = -1;
             else if(error && (r + (error / 2) * q >= d))
@@ -405,21 +405,21 @@
    return *this;
 }
 
-template <unsigned Bits>
-std::string cpp_bin_float<Bits>::str(std::streamsize dig, std::ios_base::fmtflags f) const
+template <unsigned Digits, digit_base_type DigitBase, class Allocator>
+std::string cpp_bin_float<Digits, DigitBase, Allocator>::str(std::streamsize dig, std::ios_base::fmtflags f) const
 {
    if(dig == 0)
- dig = std::numeric_limits<number<cpp_bin_float<Bits> > >::max_digits10;
+ dig = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator> > >::max_digits10;
 
    bool scientific = (f & std::ios_base::scientific) == std::ios_base::scientific;
    bool fixed = !scientific && (f & std::ios_base::fixed);
 
    std::string s;
 
- if(exponent() <= cpp_bin_float<Bits>::max_exponent)
+ if(exponent() <= cpp_bin_float<Digits, DigitBase, Allocator>::max_exponent)
    {
       // How far to left-shift in order to demormalise the mantissa:
- int shift = (int)Bits - exponent() - 1;
+ int shift = (int)cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - exponent() - 1;
       int digits_wanted = static_cast<int>(dig);
       int base10_exp = exponent() >= 0 ? static_cast<int>(std::floor(0.30103 * exponent())) : static_cast<int>(std::ceil(0.30103 * exponent()));
       //
@@ -455,17 +455,17 @@
       static const unsigned limb_bits = sizeof(limb_type) * CHAR_BIT;
       //
       // Set our working precision - this is heuristic based, we want
- // a value as small as possible > Bits to avoid large computations
+ // a value as small as possible > cpp_bin_float<Digits, DigitBase, Allocator>::bit_count to avoid large computations
       // and excessive memory usage, but we also want to avoid having to
       // up the computation and start again at a higher precision.
- // So we round Bits up to the nearest whole number of limbs, and add
+ // So we round cpp_bin_float<Digits, DigitBase, Allocator>::bit_count up to the nearest whole number of limbs, and add
       // one limb for good measure. This works very well for small exponents,
       // but for larger exponents we add a few extra limbs to max_bits:
       //
 #ifdef BOOST_MP_STRESS_IO
- int max_bits = Bits + 32;
+ int max_bits = cpp_bin_float<Digits, DigitBase, Allocator>::bit_count + 32;
 #else
- int max_bits = Bits + (Bits % limb_bits ? limb_bits - Bits % limb_bits : 0) + limb_bits;
+ int max_bits = cpp_bin_float<Digits, DigitBase, Allocator>::bit_count + (cpp_bin_float<Digits, DigitBase, Allocator>::bit_count % limb_bits ? limb_bits - cpp_bin_float<Digits, DigitBase, Allocator>::bit_count % limb_bits : 0) + limb_bits;
       if(power10)
          max_bits += (msb(std::abs(power10)) / 8) * limb_bits;
 #endif
@@ -504,7 +504,7 @@
 #else
                   max_bits *= 2;
 #endif
- shift = (int)Bits - exponent() - 1 - power10;
+ shift = (int)cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - exponent() - 1 - power10;
                   continue;
                }
             }
@@ -532,7 +532,7 @@
 #else
                   max_bits *= 2;
 #endif
- shift = (int)Bits - exponent() - 1 - power10;
+ shift = (int)cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - exponent() - 1 - power10;
                   continue;
                }
                if(shift)
@@ -545,7 +545,7 @@
 #else
                      max_bits *= 2;
 #endif
- shift = (int)Bits - exponent() - 1 - power10;
+ shift = (int)cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - exponent() - 1 - power10;
                      continue;
                   }
                   i >>= shift;
@@ -578,7 +578,7 @@
             if(fixed)
                digits_wanted = digits_got; // strange but true.
             power10 = digits_wanted - base10_exp - 1;
- shift = (int)Bits - exponent() - 1 - power10;
+ shift = (int)cpp_bin_float<Digits, DigitBase, Allocator>::bit_count - exponent() - 1 - power10;
             if(fixed)
                break;
             roundup = 0;

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/performance_test.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/performance_test.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/performance_test.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -837,9 +837,9 @@
    test<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<500> > >("cpp_dec_float", 500);
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<std::numeric_limits<boost::multiprecision::mpfr_float_50>::digits> > >("cpp_bin_float", 50);
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<std::numeric_limits<boost::multiprecision::mpfr_float_100>::digits> > >("cpp_bin_float", 100);
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<std::numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<500> > >::digits> > >("cpp_bin_float", 500);
+ test<boost::multiprecision::cpp_bin_float_50>("cpp_bin_float", 50);
+ test<boost::multiprecision::cpp_bin_float_100>("cpp_bin_float", 100);
+ test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<500> >::digits> > >("cpp_bin_float", 500);
 #endif
 #ifdef TEST_MPFR
    test<boost::multiprecision::mpfr_float_50>("mpfr_float", 50);

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_bessel2.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_bessel2.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_bessel2.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -15,6 +15,6 @@
    time_proc("cpp_dec_float_50", test_bessel<cpp_dec_float_50>, 3);
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- time_proc("cpp_bin_float_50", test_bessel<number<cpp_bin_float<std::numeric_limits<mpfr_float_50>::digits> > >, 3);
+ time_proc("cpp_bin_float_50", test_bessel<cpp_bin_float_50>, 3);
 #endif
 }

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_bessel6.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_bessel6.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_bessel6.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -11,7 +11,7 @@
    time_proc("cpp_dec_float_100", test_bessel<cpp_dec_float_100>);
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- time_proc("cpp_bin_float_100", test_bessel<number<cpp_bin_float<std::numeric_limits<mpfr_float_100>::digits> > >);
+ time_proc("cpp_bin_float_100", test_bessel<cpp_bin_float_100>);
 #endif
 #ifdef TEST_MPFR_CLASS
    time_proc("mpfr_class", test_bessel<mpfr_class>);

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_nct3.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_nct3.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_nct3.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -14,7 +14,7 @@
    time_proc("cpp_dec_float_50", test_nct<cpp_dec_float_50>);
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- time_proc("cpp_bin_float_50", test_nct<number<cpp_bin_float<std::numeric_limits<mpfr_float_50>::digits> > >, 3);
+ time_proc("cpp_bin_float_50", test_nct<cpp_bin_float_50>, 3);
 #endif
 #ifdef TEST_MPFR_CLASS
    time_proc("mpfr_class", test_nct<mpfr_class>);

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_nct6.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_nct6.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_nct6.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -14,7 +14,7 @@
    time_proc("cpp_dec_float_100", test_nct<cpp_dec_float_100>);
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- time_proc("cpp_bin_float_100", test_nct<number<cpp_bin_float<std::numeric_limits<mpfr_float_100>::digits> > >);
+ time_proc("cpp_bin_float_100", test_nct<cpp_bin_float_100>);
 #endif
 #ifdef TEST_MPFR_CLASS
    time_proc("mpfr_class", test_nct<mpfr_class>);

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_poly.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_poly.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/performance/sf_performance_poly.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -30,7 +30,7 @@
    time_proc("cpp_dec_float_50", test_polynomial<cpp_dec_float_50>);
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- time_proc("cpp_bin_float_50", test_polynomial<number<cpp_bin_float<std::numeric_limits<mpfr_float_50>::digits> > >);
+ time_proc("cpp_bin_float_50", test_polynomial<cpp_bin_float_50>);
 #endif
 #ifdef TEST_MPFR_CLASS
    time_proc("mpfr_class", test_polynomial<mpfr_class>);
@@ -61,7 +61,7 @@
    time_proc("cpp_dec_float_100", test_polynomial<cpp_dec_float_100>);
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- time_proc("cpp_bin_float_100", test_polynomial<number<cpp_bin_float<std::numeric_limits<mpfr_float_100>::digits> > >);
+ time_proc("cpp_bin_float_100", test_polynomial<cpp_bin_float_100>);
 #endif
 #ifdef TEST_MPFR_CLASS
    time_proc("mpfr_class", test_polynomial<mpfr_class>);

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/math/setup.hpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/math/setup.hpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/math/setup.hpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -95,11 +95,9 @@
 #ifdef TEST_CPP_BIN_FLOAT
 #include <boost/multiprecision/cpp_bin_float.hpp>
 
-#define CPP_BIN_FLOAT_TESTS /*test(number<cpp_bin_float<53> >(), "number<cpp_bin_float<53> >");*/\
- test(number<cpp_bin_float<113> >(), "number<cpp_bin_float<113> >");
+#define CPP_BIN_FLOAT_TESTS test(cpp_bin_float_50>(), "cpp_bin_float_50");
 
-//typedef boost::multiprecision::number<boost::multiprecision::cpp_bin_float<53> > test_type_1;
-typedef boost::multiprecision::number<boost::multiprecision::cpp_bin_float<113> > test_type_1;
+typedef boost::multiprecision::cpp_bin_float_50 test_type_1;
 
 #else
 

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_acos.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_acos.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_acos.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -135,7 +135,7 @@
    test<boost::multiprecision::float128>();
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<113> > >();
+ test<boost::multiprecision::cpp_bin_float_50>();
 #endif
    return boost::report_errors();
 }

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_arithmetic_cpp_bin_float_1.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_arithmetic_cpp_bin_float_1.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_arithmetic_cpp_bin_float_1.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -19,7 +19,7 @@
 
 int main()
 {
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<256> > >();
+ test<boost::multiprecision::cpp_bin_float_50>();
    return boost::report_errors();
 }
 

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_asin.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_asin.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_asin.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -134,7 +134,7 @@
    test<boost::multiprecision::float128>();
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<113> > >();
+ test<boost::multiprecision::cpp_bin_float_50>();
 #endif
    return boost::report_errors();
 }

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_atan.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_atan.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_atan.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -288,7 +288,7 @@
    test<boost::multiprecision::float128>();
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<113> > >();
+ test<boost::multiprecision::cpp_bin_float_50>();
 #endif
    return boost::report_errors();
 }

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cos.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cos.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cos.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -352,7 +352,7 @@
    test<boost::multiprecision::float128>();
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<113> > >();
+ test<boost::multiprecision::cpp_bin_float_50>();
 #endif
    return boost::report_errors();
 }

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cosh.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cosh.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cosh.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -179,7 +179,7 @@
    test<boost::multiprecision::float128>();
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<113> > >();
+ test<boost::multiprecision::cpp_bin_float_50>();
 #endif
    return boost::report_errors();
 }

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cpp_bin_float.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cpp_bin_float.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cpp_bin_float.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -46,7 +46,7 @@
 #else
 typedef double good_type;
 #endif
-typedef number<cpp_bin_float<std::numeric_limits<good_type>::digits>, et_off> test_type;
+typedef number<cpp_bin_float<std::numeric_limits<good_type>::digits, digit_base_2>, et_off> test_type;
 
 void test_special_cases()
 {

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cpp_bin_float_io.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cpp_bin_float_io.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cpp_bin_float_io.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -225,7 +225,7 @@
 
    stopwatch<boost::chrono::high_resolution_clock> w;
 
- for(unsigned i = 0; i < 10000; ++i)
+ while(boost::chrono::duration_cast<boost::chrono::duration<double> >(w.elapsed()).count() < 200)
    {
       T val = generate_random<T>();
       do_round_trip(val);
@@ -237,15 +237,22 @@
    std::cout << "Execution time = " << boost::chrono::duration_cast<boost::chrono::duration<double> >(w.elapsed()).count() << "s" << std::endl;
 }
 
+#if !defined(TEST1) && !defined(TEST2)
+# define TEST1
+# define TEST2
+#endif
+
 int main()
 {
    using namespace boost::multiprecision;
- test<number<cpp_bin_float<113> > >();
- test_round_trip<number<cpp_bin_float<113> > >();
-
- test<number<cpp_bin_float<53> > >();
- test_round_trip<number<cpp_bin_float<53> > >();
-
+#ifdef TEST1
+ test<number<cpp_bin_float<113, digit_base_2> > >();
+ test_round_trip<number<cpp_bin_float<113, digit_base_2> > >();
+#endif
+#ifdef TEST2
+ test<number<cpp_bin_float<53, digit_base_2> > >();
+ test_round_trip<number<cpp_bin_float<53, digit_base_2> > >();
+#endif
    return boost::report_errors();
 }
 

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_exp.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_exp.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_exp.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -222,7 +222,7 @@
    test<boost::multiprecision::float128>();
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<113> > >();
+ test<boost::multiprecision::cpp_bin_float_50>();
 #endif
    return boost::report_errors();
 }

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_fpclassify.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_fpclassify.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_fpclassify.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -335,7 +335,7 @@
    test<boost::multiprecision::float128>();
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<113> > >();
+ test<boost::multiprecision::cpp_bin_float_50>();
 #endif
    return boost::report_errors();
 }

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_log.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_log.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_log.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -255,7 +255,7 @@
    test<boost::multiprecision::float128>();
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<113> > >();
+ test<boost::multiprecision::cpp_bin_float_50>();
 #endif
    return boost::report_errors();
 }

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_numeric_limits.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_numeric_limits.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_numeric_limits.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -281,7 +281,7 @@
    test<boost::multiprecision::float128>();
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<113> > >();
+ test<boost::multiprecision::cpp_bin_float_50>();
 #endif
    return boost::report_errors();
 }

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_pow.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_pow.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_pow.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -839,7 +839,7 @@
    test<boost::multiprecision::float128>();
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<113> > >();
+ test<boost::multiprecision::cpp_bin_float_50>();
 #endif
    return boost::report_errors();
 }

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_sin.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_sin.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_sin.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -342,7 +342,7 @@
    test<boost::multiprecision::float128>();
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<113> > >();
+ test<boost::multiprecision::cpp_bin_float_50>();
 #endif
    return boost::report_errors();
 }

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_sinh.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_sinh.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_sinh.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -252,7 +252,7 @@
    test<boost::multiprecision::float128>();
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<113> > >();
+ test<boost::multiprecision::cpp_bin_float_50>();
 #endif
    return boost::report_errors();
 }

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_sqrt.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_sqrt.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_sqrt.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -233,7 +233,7 @@
    test<boost::multiprecision::float128>();
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<113> > >();
+ test<boost::multiprecision::cpp_bin_float_50>();
 #endif
    return boost::report_errors();
 }

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_tan.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_tan.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_tan.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -625,7 +625,7 @@
    test<boost::multiprecision::float128>();
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<113> > >();
+ test<boost::multiprecision::cpp_bin_float_50>();
 #endif
    return boost::report_errors();
 }

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_tanh.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_tanh.cpp Sun Oct 13 09:15:05 2013 (r86291)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_tanh.cpp 2013-10-13 13:33:22 EDT (Sun, 13 Oct 2013) (r86292)
@@ -168,7 +168,7 @@
    test<boost::multiprecision::float128>();
 #endif
 #ifdef TEST_CPP_BIN_FLOAT
- test<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<113> > >();
+ test<boost::multiprecision::cpp_bin_float_50>();
 #endif
    return boost::report_errors();
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk