|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81135 - in sandbox/big_number: boost/multiprecision libs/multiprecision/doc libs/multiprecision/doc/html libs/multiprecision/doc/html/boost_multiprecision/indexes libs/multiprecision/doc/html/boost_multiprecision/map libs/multiprecision/doc/html/boost_multiprecision/tut/floats libs/multiprecision/test
From: john_at_[hidden]
Date: 2012-11-01 15:01:10
Author: johnmaddock
Date: 2012-11-01 15:01:08 EDT (Thu, 01 Nov 2012)
New Revision: 81135
URL: http://svn.boost.org/trac/boost/changeset/81135
Log:
Add additional template parameter to mpfr_float_backend to allow stack-based floats.
Text files modified:
sandbox/big_number/boost/multiprecision/mpfr.hpp | 802 ++++++++++++++++++++++++++-------------
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html | 4
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html | 4
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html | 19
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html | 14
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html | 4
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/mpfr_float.html | 23 +
sandbox/big_number/libs/multiprecision/doc/html/index.html | 2
sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk | 20
sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp | 1
10 files changed, 617 insertions(+), 276 deletions(-)
Modified: sandbox/big_number/boost/multiprecision/mpfr.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/mpfr.hpp (original)
+++ sandbox/big_number/boost/multiprecision/mpfr.hpp 2012-11-01 15:01:08 EDT (Thu, 01 Nov 2012)
@@ -17,17 +17,24 @@
#include <cmath>
#include <algorithm>
-namespace boost{
+namespace boost{
namespace multiprecision{
+
+enum mpfr_allocation_type
+{
+ allocate_stack,
+ allocate_dynamic
+};
+
namespace backends{
-template <unsigned digits10>
+template <unsigned digits10, mpfr_allocation_type AllocationType = allocate_dynamic>
struct mpfr_float_backend;
} // namespace backends
-template <unsigned digits10>
-struct number_category<backends::mpfr_float_backend<digits10> > : public mpl::int_<number_kind_floating_point>{};
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+struct number_category<backends::mpfr_float_backend<digits10, AllocationType> > : public mpl::int_<number_kind_floating_point>{};
namespace backends{
@@ -35,15 +42,25 @@
inline long get_default_precision() { return 50; }
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+struct mpfr_float_imp;
+
template <unsigned digits10>
-struct mpfr_float_imp
+struct mpfr_float_imp<digits10, allocate_dynamic>
{
typedef mpl::list<long, long long> signed_types;
typedef mpl::list<unsigned long, unsigned long long> unsigned_types;
typedef mpl::list<double, long double> float_types;
typedef long exponent_type;
- mpfr_float_imp() BOOST_NOEXCEPT {}
+ mpfr_float_imp()
+ {
+ mpfr_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : get_default_precision()));
+ }
+ mpfr_float_imp(unsigned prec)
+ {
+ mpfr_init2(m_data, prec);
+ }
mpfr_float_imp(const mpfr_float_imp& o)
{
@@ -281,7 +298,8 @@
BOOST_ASSERT(m_data[0]._mpfr_d);
mpfr_neg(m_data, m_data, GMP_RNDN);
}
- int compare(const mpfr_float_backend<digits10>& o)const BOOST_NOEXCEPT
+ template <mpfr_allocation_type AllocationType>
+ int compare(const mpfr_float_backend<digits10, AllocationType>& o)const BOOST_NOEXCEPT
{
BOOST_ASSERT(m_data[0]._mpfr_d && o.m_data[0]._mpfr_d);
return mpfr_cmp(m_data, o.m_data);
@@ -299,19 +317,19 @@
template <class V>
int compare(V v)const BOOST_NOEXCEPT
{
- mpfr_float_backend<digits10> d;
+ mpfr_float_backend<digits10, allocate_dynamic> d;
d = v;
return compare(d);
}
- mpfr_t& data() BOOST_NOEXCEPT
- {
+ mpfr_t& data() BOOST_NOEXCEPT
+ {
BOOST_ASSERT(m_data[0]._mpfr_d);
- return m_data;
+ return m_data;
}
- const mpfr_t& data()const BOOST_NOEXCEPT
- {
+ const mpfr_t& data()const BOOST_NOEXCEPT
+ {
BOOST_ASSERT(m_data[0]._mpfr_d);
- return m_data;
+ return m_data;
}
protected:
mpfr_t m_data;
@@ -322,89 +340,344 @@
}
};
-} // namespace detail
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127) // Conditional expression is constant
+#endif
template <unsigned digits10>
-struct mpfr_float_backend : public detail::mpfr_float_imp<digits10>
+struct mpfr_float_imp<digits10, allocate_stack>
{
- mpfr_float_backend()
+ typedef mpl::list<long, long long> signed_types;
+ typedef mpl::list<unsigned long, unsigned long long> unsigned_types;
+ typedef mpl::list<double, long double> float_types;
+ typedef long exponent_type;
+
+ static const unsigned digits2 = (digits10 * 1000uL) / 301uL + ((digits10 * 1000uL) % 301 ? 2u : 1u);
+ static const unsigned limb_count = mpfr_custom_get_size(digits2) / sizeof(mp_limb_t);
+
+ mpfr_float_imp()
+ {
+ mpfr_custom_init(m_buffer, digits2);
+ mpfr_custom_init_set(m_data, MPFR_NAN_KIND, 0, digits2, m_buffer);
+ }
+
+ mpfr_float_imp(const mpfr_float_imp& o)
+ {
+ mpfr_custom_init(m_buffer, digits2);
+ mpfr_custom_init_set(m_data, MPFR_NAN_KIND, 0, digits2, m_buffer);
+ mpfr_set(m_data, o.m_data, GMP_RNDN);
+ }
+ mpfr_float_imp& operator = (const mpfr_float_imp& o) BOOST_NOEXCEPT
+ {
+ mpfr_set(m_data, o.m_data, GMP_RNDN);
+ return *this;
+ }
+#ifdef _MPFR_H_HAVE_INTMAX_T
+ mpfr_float_imp& operator = (unsigned long long i) BOOST_NOEXCEPT
+ {
+ mpfr_set_uj(m_data, i, GMP_RNDN);
+ return *this;
+ }
+ mpfr_float_imp& operator = (long long i) BOOST_NOEXCEPT
+ {
+ mpfr_set_sj(m_data, i, GMP_RNDN);
+ return *this;
+ }
+#else
+ mpfr_float_imp& operator = (unsigned long long i)
+ {
+ unsigned long long mask = ((1uLL << std::numeric_limits<unsigned>::digits) - 1);
+ unsigned shift = 0;
+ mpfr_t t;
+ mp_limb_t t_limbs[limb_count];
+ mpfr_custom_init(t_limbs, digits2);
+ mpfr_custom_init_set(t, MPFR_NAN_KIND, 0, digits2, t_limbs);
+ mpfr_set_ui(m_data, 0, GMP_RNDN);
+ while(i)
+ {
+ mpfr_set_ui(t, static_cast<unsigned>(i & mask), GMP_RNDN);
+ if(shift)
+ mpfr_mul_2exp(t, t, shift, GMP_RNDN);
+ mpfr_add(m_data, m_data, t, GMP_RNDN);
+ shift += std::numeric_limits<unsigned>::digits;
+ i >>= std::numeric_limits<unsigned>::digits;
+ }
+ return *this;
+ }
+ mpfr_float_imp& operator = (long long i)
+ {
+ BOOST_MP_USING_ABS
+ bool neg = i < 0;
+ *this = static_cast<unsigned long long>(abs(i));
+ if(neg)
+ mpfr_neg(m_data, m_data, GMP_RNDN);
+ return *this;
+ }
+#endif
+ mpfr_float_imp& operator = (unsigned long i) BOOST_NOEXCEPT
+ {
+ mpfr_set_ui(m_data, i, GMP_RNDN);
+ return *this;
+ }
+ mpfr_float_imp& operator = (long i) BOOST_NOEXCEPT
+ {
+ mpfr_set_si(m_data, i, GMP_RNDN);
+ return *this;
+ }
+ mpfr_float_imp& operator = (double d) BOOST_NOEXCEPT
+ {
+ mpfr_set_d(m_data, d, GMP_RNDN);
+ return *this;
+ }
+ mpfr_float_imp& operator = (long double a) BOOST_NOEXCEPT
+ {
+ mpfr_set_ld(m_data, a, GMP_RNDN);
+ return *this;
+ }
+ mpfr_float_imp& operator = (const char* s)
+ {
+ if(mpfr_set_str(m_data, s, 10, GMP_RNDN) != 0)
+ {
+ BOOST_THROW_EXCEPTION(std::runtime_error(std::string("Unable to parse string \"") + s + std::string("\"as a valid floating point number.")));
+ }
+ return *this;
+ }
+ void swap(mpfr_float_imp& o) BOOST_NOEXCEPT
+ {
+ // We have to swap by copying:
+ mpfr_float_imp t(*this);
+ *this = o;
+ o = t;
+ }
+ std::string str(std::streamsize digits, std::ios_base::fmtflags f)const
+ {
+ BOOST_ASSERT(m_data[0]._mpfr_d);
+
+ bool scientific = (f & std::ios_base::scientific) == std::ios_base::scientific;
+ bool fixed = (f & std::ios_base::fixed) == std::ios_base::fixed;
+
+ std::streamsize org_digits(digits);
+
+ if(scientific && digits)
+ ++digits;
+
+ std::string result;
+ mp_exp_t e;
+ if(mpfr_inf_p(m_data))
+ {
+ if(mpfr_sgn(m_data) < 0)
+ result = "-inf";
+ else if(f & std::ios_base::showpos)
+ result = "+inf";
+ else
+ result = "inf";
+ return result;
+ }
+ if(mpfr_nan_p(m_data))
+ {
+ result = "nan";
+ return result;
+ }
+ if(mpfr_zero_p(m_data))
+ {
+ e = 0;
+ result = "0";
+ }
+ else
+ {
+ char* ps = mpfr_get_str (0, &e, 10, static_cast<std::size_t>(digits), m_data, GMP_RNDN);
+ --e; // To match with what our formatter expects.
+ if(fixed && e != -1)
+ {
+ // Oops we actually need a different number of digits to what we asked for:
+ mpfr_free_str(ps);
+ digits += e + 1;
+ if(digits == 0)
+ {
+ // We need to get *all* the digits and then possibly round up,
+ // we end up with either "0" or "1" as the result.
+ ps = mpfr_get_str (0, &e, 10, 0, m_data, GMP_RNDN);
+ --e;
+ unsigned offset = *ps == '-' ? 1 : 0;
+ if(ps[offset] > '5')
+ {
+ ++e;
+ ps[offset] = '1';
+ ps[offset + 1] = 0;
+ }
+ else if(ps[offset] == '5')
+ {
+ unsigned i = offset + 1;
+ bool round_up = false;
+ while(ps[i] != 0)
+ {
+ if(ps[i] != '0')
+ {
+ round_up = true;
+ break;
+ }
+ }
+ if(round_up)
+ {
+ ++e;
+ ps[offset] = '1';
+ ps[offset + 1] = 0;
+ }
+ else
+ {
+ ps[offset] = '0';
+ ps[offset + 1] = 0;
+ }
+ }
+ else
+ {
+ ps[offset] = '0';
+ ps[offset + 1] = 0;
+ }
+ }
+ else if(digits > 0)
+ {
+ ps = mpfr_get_str (0, &e, 10, static_cast<std::size_t>(digits), m_data, GMP_RNDN);
+ --e; // To match with what our formatter expects.
+ }
+ else
+ {
+ ps = mpfr_get_str (0, &e, 10, 1, m_data, GMP_RNDN);
+ --e;
+ unsigned offset = *ps == '-' ? 1 : 0;
+ ps[offset] = '0';
+ ps[offset + 1] = 0;
+ }
+ }
+ result = ps ? ps : "0";
+ if(ps)
+ mpfr_free_str(ps);
+ }
+ boost::multiprecision::detail::format_float_string(result, e, org_digits, f, 0 != mpfr_zero_p(m_data));
+ return result;
+ }
+ void negate() BOOST_NOEXCEPT
+ {
+ mpfr_neg(m_data, m_data, GMP_RNDN);
+ }
+ template <mpfr_allocation_type AllocationType>
+ int compare(const mpfr_float_backend<digits10, AllocationType>& o)const BOOST_NOEXCEPT
+ {
+ return mpfr_cmp(m_data, o.m_data);
+ }
+ int compare(long i)const BOOST_NOEXCEPT
+ {
+ return mpfr_cmp_si(m_data, i);
+ }
+ int compare(unsigned long i)const BOOST_NOEXCEPT
{
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(digits10));
+ return mpfr_cmp_ui(m_data, i);
}
- mpfr_float_backend(const mpfr_float_backend& o) : detail::mpfr_float_imp<digits10>(o) {}
+ template <class V>
+ int compare(V v)const BOOST_NOEXCEPT
+ {
+ mpfr_float_backend<digits10, allocate_stack> d;
+ d = v;
+ return compare(d);
+ }
+ mpfr_t& data() BOOST_NOEXCEPT
+ {
+ return m_data;
+ }
+ const mpfr_t& data()const BOOST_NOEXCEPT
+ {
+ return m_data;
+ }
+protected:
+ mpfr_t m_data;
+ mp_limb_t m_buffer[limb_count];
+};
+
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
+} // namespace detail
+
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+struct mpfr_float_backend : public detail::mpfr_float_imp<digits10, AllocationType>
+{
+ mpfr_float_backend() : detail::mpfr_float_imp<digits10, AllocationType>() {}
+ mpfr_float_backend(const mpfr_float_backend& o) : detail::mpfr_float_imp<digits10, AllocationType>(o) {}
#ifndef BOOST_NO_RVALUE_REFERENCES
- mpfr_float_backend(mpfr_float_backend&& o) : detail::mpfr_float_imp<digits10>(static_cast<detail::mpfr_float_imp<digits10>&&>(o)) {}
+ mpfr_float_backend(mpfr_float_backend&& o) : detail::mpfr_float_imp<digits10, AllocationType>(static_cast<detail::mpfr_float_imp<digits10, AllocationType>&&>(o)) {}
#endif
template <unsigned D>
mpfr_float_backend(const mpfr_float_backend<D>& val, typename enable_if_c<D <= digits10>::type* = 0)
+ : detail::mpfr_float_imp<digits10, AllocationType>()
{
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(digits10));
mpfr_set(this->m_data, val.data(), GMP_RNDN);
}
template <unsigned D>
explicit mpfr_float_backend(const mpfr_float_backend<D>& val, typename disable_if_c<D <= digits10>::type* = 0)
+ : detail::mpfr_float_imp<digits10, AllocationType>()
{
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(digits10));
mpfr_set(this->m_data, val.data(), GMP_RNDN);
}
template <unsigned D>
mpfr_float_backend(const gmp_float<D>& val, typename enable_if_c<D <= digits10>::type* = 0)
+ : detail::mpfr_float_imp<digits10, AllocationType>()
{
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(digits10));
mpfr_set_f(this->m_data, val.data(), GMP_RNDN);
}
template <unsigned D>
mpfr_float_backend(const gmp_float<D>& val, typename disable_if_c<D <= digits10>::type* = 0)
+ : detail::mpfr_float_imp<digits10, AllocationType>()
{
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(digits10));
mpfr_set_f(this->m_data, val.data(), GMP_RNDN);
}
mpfr_float_backend(const gmp_int& val)
+ : detail::mpfr_float_imp<digits10, AllocationType>()
{
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(digits10));
mpfr_set_z(this->m_data, val.data(), GMP_RNDN);
}
mpfr_float_backend(const gmp_rational& val)
+ : detail::mpfr_float_imp<digits10, AllocationType>()
{
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(digits10));
mpfr_set_q(this->m_data, val.data(), GMP_RNDN);
}
mpfr_float_backend(const mpfr_t val)
+ : detail::mpfr_float_imp<digits10, AllocationType>()
{
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(digits10));
mpfr_set(this->m_data, val, GMP_RNDN);
}
mpfr_float_backend(const mpf_t val)
+ : detail::mpfr_float_imp<digits10, AllocationType>()
{
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(digits10));
mpfr_set_f(this->m_data, val, GMP_RNDN);
}
mpfr_float_backend(const mpz_t val)
+ : detail::mpfr_float_imp<digits10, AllocationType>()
{
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(digits10));
mpfr_set_z(this->m_data, val, GMP_RNDN);
}
mpfr_float_backend(const mpq_t val)
+ : detail::mpfr_float_imp<digits10, AllocationType>()
{
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(digits10));
mpfr_set_q(this->m_data, val, GMP_RNDN);
}
mpfr_float_backend& operator=(const mpfr_float_backend& o)
{
- *static_cast<detail::mpfr_float_imp<digits10>*>(this) = static_cast<detail::mpfr_float_imp<digits10> const&>(o);
+ *static_cast<detail::mpfr_float_imp<digits10, AllocationType>*>(this) = static_cast<detail::mpfr_float_imp<digits10, AllocationType> const&>(o);
return *this;
}
#ifndef BOOST_NO_RVALUE_REFERENCES
mpfr_float_backend& operator=(mpfr_float_backend&& o) BOOST_NOEXCEPT
{
- *static_cast<detail::mpfr_float_imp<digits10>*>(this) = static_cast<detail::mpfr_float_imp<digits10>&&>(o);
+ *static_cast<detail::mpfr_float_imp<digits10, AllocationType>*>(this) = static_cast<detail::mpfr_float_imp<digits10, AllocationType>&&>(o);
return *this;
}
#endif
template <class V>
mpfr_float_backend& operator=(const V& v)
{
- *static_cast<detail::mpfr_float_imp<digits10>*>(this) = v;
+ *static_cast<detail::mpfr_float_imp<digits10, AllocationType>*>(this) = v;
return *this;
}
mpfr_float_backend& operator=(const mpfr_t val)BOOST_NOEXCEPT
@@ -453,80 +726,78 @@
};
template <>
-struct mpfr_float_backend<0> : public detail::mpfr_float_imp<0>
+struct mpfr_float_backend<0, allocate_dynamic> : public detail::mpfr_float_imp<0, allocate_dynamic>
{
- mpfr_float_backend()
- {
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(get_default_precision()));
- }
+ mpfr_float_backend() : detail::mpfr_float_imp<0, allocate_dynamic>() {}
mpfr_float_backend(const mpfr_t val)
+ : detail::mpfr_float_imp<0, allocate_dynamic>(mpfr_get_prec(val))
{
- mpfr_init2(this->m_data, mpfr_get_prec(val));
mpfr_set(this->m_data, val, GMP_RNDN);
}
mpfr_float_backend(const mpf_t val)
+ : detail::mpfr_float_imp<0, allocate_dynamic>(mpf_get_prec(val))
{
- mpfr_init2(this->m_data, mpf_get_prec(val));
mpfr_set_f(this->m_data, val, GMP_RNDN);
}
mpfr_float_backend(const mpz_t val)
+ : detail::mpfr_float_imp<0, allocate_dynamic>()
{
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(get_default_precision()));
mpfr_set_z(this->m_data, val, GMP_RNDN);
}
mpfr_float_backend(const mpq_t val)
+ : detail::mpfr_float_imp<0, allocate_dynamic>()
{
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(get_default_precision()));
mpfr_set_q(this->m_data, val, GMP_RNDN);
}
- mpfr_float_backend(const mpfr_float_backend& o) : detail::mpfr_float_imp<0>(o) {}
+ mpfr_float_backend(const mpfr_float_backend& o) : detail::mpfr_float_imp<0, allocate_dynamic>(o) {}
#ifndef BOOST_NO_RVALUE_REFERENCES
- mpfr_float_backend(mpfr_float_backend&& o) BOOST_NOEXCEPT : detail::mpfr_float_imp<0>(static_cast<detail::mpfr_float_imp<0>&&>(o)) {}
+ mpfr_float_backend(mpfr_float_backend&& o) BOOST_NOEXCEPT : detail::mpfr_float_imp<0, allocate_dynamic>(static_cast<detail::mpfr_float_imp<0, allocate_dynamic>&&>(o)) {}
#endif
- mpfr_float_backend(const mpfr_float_backend& o, unsigned digits10)
+ mpfr_float_backend(const mpfr_float_backend& o, unsigned digits10)
+ : detail::mpfr_float_imp<0, allocate_dynamic>(digits10)
{
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(digits10));
*this = o;
}
template <unsigned D>
mpfr_float_backend(const mpfr_float_backend<D>& val)
+ : detail::mpfr_float_imp<0, allocate_dynamic>(mpfr_get_prec(val.data()))
{
- mpfr_init2(this->m_data, mpfr_get_prec(val.data()));
mpfr_set(this->m_data, val.data(), GMP_RNDN);
}
template <unsigned D>
mpfr_float_backend(const gmp_float<D>& val)
+ : detail::mpfr_float_imp<0, allocate_dynamic>(mpf_get_prec(val.data()))
{
- mpfr_init2(this->m_data, mpf_get_prec(val.data()));
mpfr_set_f(this->m_data, val.data(), GMP_RNDN);
}
mpfr_float_backend(const gmp_int& val)
+ : detail::mpfr_float_imp<0, allocate_dynamic>()
{
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(get_default_precision()));
mpfr_set_z(this->m_data, val.data(), GMP_RNDN);
}
mpfr_float_backend(const gmp_rational& val)
+ : detail::mpfr_float_imp<0, allocate_dynamic>()
{
- mpfr_init2(this->m_data, multiprecision::detail::digits10_2_2(get_default_precision()));
mpfr_set_q(this->m_data, val.data(), GMP_RNDN);
}
mpfr_float_backend& operator=(const mpfr_float_backend& o)
{
- *static_cast<detail::mpfr_float_imp<0>*>(this) = static_cast<detail::mpfr_float_imp<0> const&>(o);
+ mpfr_set_prec(this->m_data, mpfr_get_prec(o.data()));
+ mpfr_set(this->m_data, o.data(), GMP_RNDN);
return *this;
}
#ifndef BOOST_NO_RVALUE_REFERENCES
mpfr_float_backend& operator=(mpfr_float_backend&& o) BOOST_NOEXCEPT
{
- *static_cast<detail::mpfr_float_imp<0>*>(this) = static_cast<detail::mpfr_float_imp<0> &&>(o);
+ *static_cast<detail::mpfr_float_imp<0, allocate_dynamic>*>(this) = static_cast<detail::mpfr_float_imp<0, allocate_dynamic> &&>(o);
return *this;
}
#endif
template <class V>
mpfr_float_backend& operator=(const V& v)
{
- *static_cast<detail::mpfr_float_imp<0>*>(this) = v;
+ *static_cast<detail::mpfr_float_imp<0, allocate_dynamic>*>(this) = v;
return *this;
}
mpfr_float_backend& operator=(const mpfr_t val) BOOST_NOEXCEPT
@@ -593,87 +864,87 @@
}
};
-template <unsigned digits10, class T>
-inline typename enable_if<is_arithmetic<T>, bool>::type eval_eq(const mpfr_float_backend<digits10>& a, const T& b) BOOST_NOEXCEPT
+template <unsigned digits10, mpfr_allocation_type AllocationType, class T>
+inline typename enable_if<is_arithmetic<T>, bool>::type eval_eq(const mpfr_float_backend<digits10, AllocationType>& a, const T& b) BOOST_NOEXCEPT
{
return a.compare(b) == 0;
}
-template <unsigned digits10, class T>
-inline typename enable_if<is_arithmetic<T>, bool>::type eval_lt(const mpfr_float_backend<digits10>& a, const T& b) BOOST_NOEXCEPT
+template <unsigned digits10, mpfr_allocation_type AllocationType, class T>
+inline typename enable_if<is_arithmetic<T>, bool>::type eval_lt(const mpfr_float_backend<digits10, AllocationType>& a, const T& b) BOOST_NOEXCEPT
{
return a.compare(b) < 0;
}
-template <unsigned digits10, class T>
-inline typename enable_if<is_arithmetic<T>, bool>::type eval_gt(const mpfr_float_backend<digits10>& a, const T& b) BOOST_NOEXCEPT
+template <unsigned digits10, mpfr_allocation_type AllocationType, class T>
+inline typename enable_if<is_arithmetic<T>, bool>::type eval_gt(const mpfr_float_backend<digits10, AllocationType>& a, const T& b) BOOST_NOEXCEPT
{
return a.compare(b) > 0;
}
-template <unsigned D1, unsigned D2>
-inline void eval_add(mpfr_float_backend<D1>& result, const mpfr_float_backend<D2>& o) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_add(mpfr_float_backend<D1, A1>& result, const mpfr_float_backend<D2, A2>& o) BOOST_NOEXCEPT
{
mpfr_add(result.data(), result.data(), o.data(), GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_subtract(mpfr_float_backend<D1>& result, const mpfr_float_backend<D2>& o) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_subtract(mpfr_float_backend<D1, A1>& result, const mpfr_float_backend<D2, A2>& o) BOOST_NOEXCEPT
{
mpfr_sub(result.data(), result.data(), o.data(), GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_multiply(mpfr_float_backend<D1>& result, const mpfr_float_backend<D2>& o) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_multiply(mpfr_float_backend<D1, A1>& result, const mpfr_float_backend<D2, A2>& o) BOOST_NOEXCEPT
{
mpfr_mul(result.data(), result.data(), o.data(), GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_divide(mpfr_float_backend<D1>& result, const mpfr_float_backend<D2>& o)
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_divide(mpfr_float_backend<D1, A1>& result, const mpfr_float_backend<D2, A2>& o)
{
mpfr_div(result.data(), result.data(), o.data(), GMP_RNDN);
}
-template <unsigned digits10>
-inline void eval_add(mpfr_float_backend<digits10>& result, unsigned long i) BOOST_NOEXCEPT
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+inline void eval_add(mpfr_float_backend<digits10, AllocationType>& result, unsigned long i) BOOST_NOEXCEPT
{
mpfr_add_ui(result.data(), result.data(), i, GMP_RNDN);
}
-template <unsigned digits10>
-inline void eval_subtract(mpfr_float_backend<digits10>& result, unsigned long i) BOOST_NOEXCEPT
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+inline void eval_subtract(mpfr_float_backend<digits10, AllocationType>& result, unsigned long i) BOOST_NOEXCEPT
{
mpfr_sub_ui(result.data(), result.data(), i, GMP_RNDN);
}
-template <unsigned digits10>
-inline void eval_multiply(mpfr_float_backend<digits10>& result, unsigned long i) BOOST_NOEXCEPT
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+inline void eval_multiply(mpfr_float_backend<digits10, AllocationType>& result, unsigned long i) BOOST_NOEXCEPT
{
mpfr_mul_ui(result.data(), result.data(), i, GMP_RNDN);
}
-template <unsigned digits10>
-inline void eval_divide(mpfr_float_backend<digits10>& result, unsigned long i)
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+inline void eval_divide(mpfr_float_backend<digits10, AllocationType>& result, unsigned long i)
{
mpfr_div_ui(result.data(), result.data(), i, GMP_RNDN);
}
-template <unsigned digits10>
-inline void eval_add(mpfr_float_backend<digits10>& result, long i) BOOST_NOEXCEPT
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+inline void eval_add(mpfr_float_backend<digits10, AllocationType>& result, long i) BOOST_NOEXCEPT
{
if(i > 0)
mpfr_add_ui(result.data(), result.data(), i, GMP_RNDN);
else
mpfr_sub_ui(result.data(), result.data(), std::abs(i), GMP_RNDN);
}
-template <unsigned digits10>
-inline void eval_subtract(mpfr_float_backend<digits10>& result, long i) BOOST_NOEXCEPT
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+inline void eval_subtract(mpfr_float_backend<digits10, AllocationType>& result, long i) BOOST_NOEXCEPT
{
if(i > 0)
mpfr_sub_ui(result.data(), result.data(), i, GMP_RNDN);
else
mpfr_add_ui(result.data(), result.data(), std::abs(i), GMP_RNDN);
}
-template <unsigned digits10>
-inline void eval_multiply(mpfr_float_backend<digits10>& result, long i) BOOST_NOEXCEPT
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+inline void eval_multiply(mpfr_float_backend<digits10, AllocationType>& result, long i) BOOST_NOEXCEPT
{
mpfr_mul_ui(result.data(), result.data(), std::abs(i), GMP_RNDN);
if(i < 0)
mpfr_neg(result.data(), result.data(), GMP_RNDN);
}
-template <unsigned digits10>
-inline void eval_divide(mpfr_float_backend<digits10>& result, long i)
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+inline void eval_divide(mpfr_float_backend<digits10, AllocationType>& result, long i)
{
mpfr_div_ui(result.data(), result.data(), std::abs(i), GMP_RNDN);
if(i < 0)
@@ -682,31 +953,31 @@
//
// Specialised 3 arg versions of the basic operators:
//
-template <unsigned D1, unsigned D2, unsigned D3>
-inline void eval_add(mpfr_float_backend<D1>& a, const mpfr_float_backend<D2>& x, const mpfr_float_backend<D3>& y) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2, unsigned D3>
+inline void eval_add(mpfr_float_backend<D1, A1>& a, const mpfr_float_backend<D2, A2>& x, const mpfr_float_backend<D3>& y) BOOST_NOEXCEPT
{
mpfr_add(a.data(), x.data(), y.data(), GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_add(mpfr_float_backend<D1>& a, const mpfr_float_backend<D2>& x, unsigned long y) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_add(mpfr_float_backend<D1, A1>& a, const mpfr_float_backend<D2, A2>& x, unsigned long y) BOOST_NOEXCEPT
{
mpfr_add_ui(a.data(), x.data(), y, GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_add(mpfr_float_backend<D1>& a, const mpfr_float_backend<D2>& x, long y) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_add(mpfr_float_backend<D1, A1>& a, const mpfr_float_backend<D2, A2>& x, long y) BOOST_NOEXCEPT
{
if(y < 0)
mpfr_sub_ui(a.data(), x.data(), -y, GMP_RNDN);
else
mpfr_add_ui(a.data(), x.data(), y, GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_add(mpfr_float_backend<D1>& a, unsigned long x, const mpfr_float_backend<D2>& y) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_add(mpfr_float_backend<D1, A1>& a, unsigned long x, const mpfr_float_backend<D2, A2>& y) BOOST_NOEXCEPT
{
mpfr_add_ui(a.data(), y.data(), x, GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_add(mpfr_float_backend<D1>& a, long x, const mpfr_float_backend<D2>& y) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_add(mpfr_float_backend<D1, A1>& a, long x, const mpfr_float_backend<D2, A2>& y) BOOST_NOEXCEPT
{
if(x < 0)
{
@@ -716,31 +987,31 @@
else
mpfr_add_ui(a.data(), y.data(), x, GMP_RNDN);
}
-template <unsigned D1, unsigned D2, unsigned D3>
-inline void eval_subtract(mpfr_float_backend<D1>& a, const mpfr_float_backend<D2>& x, const mpfr_float_backend<D3>& y) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2, unsigned D3>
+inline void eval_subtract(mpfr_float_backend<D1, A1>& a, const mpfr_float_backend<D2, A2>& x, const mpfr_float_backend<D3>& y) BOOST_NOEXCEPT
{
mpfr_sub(a.data(), x.data(), y.data(), GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_subtract(mpfr_float_backend<D1>& a, const mpfr_float_backend<D2>& x, unsigned long y) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_subtract(mpfr_float_backend<D1, A1>& a, const mpfr_float_backend<D2, A2>& x, unsigned long y) BOOST_NOEXCEPT
{
mpfr_sub_ui(a.data(), x.data(), y, GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_subtract(mpfr_float_backend<D1>& a, const mpfr_float_backend<D2>& x, long y) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_subtract(mpfr_float_backend<D1, A1>& a, const mpfr_float_backend<D2, A2>& x, long y) BOOST_NOEXCEPT
{
if(y < 0)
mpfr_add_ui(a.data(), x.data(), -y, GMP_RNDN);
else
mpfr_sub_ui(a.data(), x.data(), y, GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_subtract(mpfr_float_backend<D1>& a, unsigned long x, const mpfr_float_backend<D2>& y) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_subtract(mpfr_float_backend<D1, A1>& a, unsigned long x, const mpfr_float_backend<D2, A2>& y) BOOST_NOEXCEPT
{
mpfr_ui_sub(a.data(), x, y.data(), GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_subtract(mpfr_float_backend<D1>& a, long x, const mpfr_float_backend<D2>& y) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_subtract(mpfr_float_backend<D1, A1>& a, long x, const mpfr_float_backend<D2, A2>& y) BOOST_NOEXCEPT
{
if(x < 0)
{
@@ -751,18 +1022,18 @@
mpfr_ui_sub(a.data(), x, y.data(), GMP_RNDN);
}
-template <unsigned D1, unsigned D2, unsigned D3>
-inline void eval_multiply(mpfr_float_backend<D1>& a, const mpfr_float_backend<D2>& x, const mpfr_float_backend<D3>& y) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2, unsigned D3>
+inline void eval_multiply(mpfr_float_backend<D1, A1>& a, const mpfr_float_backend<D2, A2>& x, const mpfr_float_backend<D3>& y) BOOST_NOEXCEPT
{
mpfr_mul(a.data(), x.data(), y.data(), GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_multiply(mpfr_float_backend<D1>& a, const mpfr_float_backend<D2>& x, unsigned long y) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_multiply(mpfr_float_backend<D1, A1>& a, const mpfr_float_backend<D2, A2>& x, unsigned long y) BOOST_NOEXCEPT
{
mpfr_mul_ui(a.data(), x.data(), y, GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_multiply(mpfr_float_backend<D1>& a, const mpfr_float_backend<D2>& x, long y) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_multiply(mpfr_float_backend<D1, A1>& a, const mpfr_float_backend<D2, A2>& x, long y) BOOST_NOEXCEPT
{
if(y < 0)
{
@@ -772,13 +1043,13 @@
else
mpfr_mul_ui(a.data(), x.data(), y, GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_multiply(mpfr_float_backend<D1>& a, unsigned long x, const mpfr_float_backend<D2>& y) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_multiply(mpfr_float_backend<D1, A1>& a, unsigned long x, const mpfr_float_backend<D2, A2>& y) BOOST_NOEXCEPT
{
mpfr_mul_ui(a.data(), y.data(), x, GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_multiply(mpfr_float_backend<D1>& a, long x, const mpfr_float_backend<D2>& y) BOOST_NOEXCEPT
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_multiply(mpfr_float_backend<D1, A1>& a, long x, const mpfr_float_backend<D2, A2>& y) BOOST_NOEXCEPT
{
if(x < 0)
{
@@ -789,18 +1060,18 @@
mpfr_mul_ui(a.data(), y.data(), x, GMP_RNDN);
}
-template <unsigned D1, unsigned D2, unsigned D3>
-inline void eval_divide(mpfr_float_backend<D1>& a, const mpfr_float_backend<D2>& x, const mpfr_float_backend<D3>& y)
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2, unsigned D3>
+inline void eval_divide(mpfr_float_backend<D1, A1>& a, const mpfr_float_backend<D2, A2>& x, const mpfr_float_backend<D3>& y)
{
mpfr_div(a.data(), x.data(), y.data(), GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_divide(mpfr_float_backend<D1>& a, const mpfr_float_backend<D2>& x, unsigned long y)
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_divide(mpfr_float_backend<D1, A1>& a, const mpfr_float_backend<D2, A2>& x, unsigned long y)
{
mpfr_div_ui(a.data(), x.data(), y, GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_divide(mpfr_float_backend<D1>& a, const mpfr_float_backend<D2>& x, long y)
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_divide(mpfr_float_backend<D1, A1>& a, const mpfr_float_backend<D2, A2>& x, long y)
{
if(y < 0)
{
@@ -810,13 +1081,13 @@
else
mpfr_div_ui(a.data(), x.data(), y, GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_divide(mpfr_float_backend<D1>& a, unsigned long x, const mpfr_float_backend<D2>& y)
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_divide(mpfr_float_backend<D1, A1>& a, unsigned long x, const mpfr_float_backend<D2, A2>& y)
{
mpfr_ui_div(a.data(), x, y.data(), GMP_RNDN);
}
-template <unsigned D1, unsigned D2>
-inline void eval_divide(mpfr_float_backend<D1>& a, long x, const mpfr_float_backend<D2>& y)
+template <unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+inline void eval_divide(mpfr_float_backend<D1, A1>& a, long x, const mpfr_float_backend<D2, A2>& y)
{
if(x < 0)
{
@@ -827,19 +1098,19 @@
mpfr_ui_div(a.data(), x, y.data(), GMP_RNDN);
}
-template <unsigned digits10>
-inline bool eval_is_zero(const mpfr_float_backend<digits10>& val) BOOST_NOEXCEPT
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+inline bool eval_is_zero(const mpfr_float_backend<digits10, AllocationType>& val) BOOST_NOEXCEPT
{
return 0 != mpfr_zero_p(val.data());
}
-template <unsigned digits10>
-inline int eval_get_sign(const mpfr_float_backend<digits10>& val) BOOST_NOEXCEPT
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+inline int eval_get_sign(const mpfr_float_backend<digits10, AllocationType>& val) BOOST_NOEXCEPT
{
return mpfr_sgn(val.data());
}
-template <unsigned digits10>
-inline void eval_convert_to(unsigned long* result, const mpfr_float_backend<digits10>& val)
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+inline void eval_convert_to(unsigned long* result, const mpfr_float_backend<digits10, AllocationType>& val)
{
if(mpfr_nan_p(val.data()))
{
@@ -847,8 +1118,8 @@
}
*result = mpfr_get_ui(val.data(), GMP_RNDN);
}
-template <unsigned digits10>
-inline void eval_convert_to(long* result, const mpfr_float_backend<digits10>& val)
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+inline void eval_convert_to(long* result, const mpfr_float_backend<digits10, AllocationType>& val)
{
if(mpfr_nan_p(val.data()))
{
@@ -857,8 +1128,8 @@
*result = mpfr_get_si(val.data(), GMP_RNDN);
}
#ifdef _MPFR_H_HAVE_INTMAX_T
-template <unsigned digits10>
-inline void eval_convert_to(unsigned long long* result, const mpfr_float_backend<digits10>& val)
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+inline void eval_convert_to(unsigned long long* result, const mpfr_float_backend<digits10, AllocationType>& val)
{
if(mpfr_nan_p(val.data()))
{
@@ -866,8 +1137,8 @@
}
*result = mpfr_get_uj(val.data(), GMP_RNDN);
}
-template <unsigned digits10>
-inline void eval_convert_to(long long* result, const mpfr_float_backend<digits10>& val)
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+inline void eval_convert_to(long long* result, const mpfr_float_backend<digits10, AllocationType>& val)
{
if(mpfr_nan_p(val.data()))
{
@@ -876,13 +1147,13 @@
*result = mpfr_get_sj(val.data(), GMP_RNDN);
}
#endif
-template <unsigned digits10>
-inline void eval_convert_to(double* result, const mpfr_float_backend<digits10>& val) BOOST_NOEXCEPT
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+inline void eval_convert_to(double* result, const mpfr_float_backend<digits10, AllocationType>& val) BOOST_NOEXCEPT
{
*result = mpfr_get_d(val.data(), GMP_RNDN);
}
-template <unsigned digits10>
-inline void eval_convert_to(long double* result, const mpfr_float_backend<digits10>& val) BOOST_NOEXCEPT
+template <unsigned digits10, mpfr_allocation_type AllocationType>
+inline void eval_convert_to(long double* result, const mpfr_float_backend<digits10, AllocationType>& val) BOOST_NOEXCEPT
{
*result = mpfr_get_ld(val.data(), GMP_RNDN);
}
@@ -890,45 +1161,45 @@
//
// Native non-member operations:
//
-template <unsigned Digits10>
-inline void eval_sqrt(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& val) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_sqrt(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& val) BOOST_NOEXCEPT
{
mpfr_sqrt(result.data(), val.data(), GMP_RNDN);
}
-template <unsigned Digits10>
-inline void eval_abs(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& val) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_abs(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& val) BOOST_NOEXCEPT
{
mpfr_abs(result.data(), val.data(), GMP_RNDN);
}
-template <unsigned Digits10>
-inline void eval_fabs(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& val) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_fabs(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& val) BOOST_NOEXCEPT
{
mpfr_abs(result.data(), val.data(), GMP_RNDN);
}
-template <unsigned Digits10>
-inline void eval_ceil(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& val) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_ceil(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& val) BOOST_NOEXCEPT
{
mpfr_ceil(result.data(), val.data());
}
-template <unsigned Digits10>
-inline void eval_floor(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& val) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_floor(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& val) BOOST_NOEXCEPT
{
mpfr_floor(result.data(), val.data());
}
-template <unsigned Digits10>
-inline void eval_trunc(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& val)
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_trunc(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& val)
{
if(0 == mpfr_number_p(val.data()))
{
- result = boost::math::policies::raise_rounding_error("boost::multiprecision::trunc<%1%>(%1%)", 0, number<mpfr_float_backend<Digits10> >(val), 0, boost::math::policies::policy<>()).backend();
+ result = boost::math::policies::raise_rounding_error("boost::multiprecision::trunc<%1%>(%1%)", 0, number<mpfr_float_backend<Digits10, AllocateType> >(val), 0, boost::math::policies::policy<>()).backend();
return;
}
mpfr_trunc(result.data(), val.data());
}
-template <unsigned Digits10>
-inline void eval_ldexp(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& val, long e) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_ldexp(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& val, long e) BOOST_NOEXCEPT
{
if(e > 0)
mpfr_mul_2exp(result.data(), val.data(), e, GMP_RNDN);
@@ -937,29 +1208,29 @@
else
result = val;
}
-template <unsigned Digits10>
-inline void eval_frexp(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& val, int* e) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_frexp(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& val, int* e) BOOST_NOEXCEPT
{
long v;
mpfr_get_d_2exp(&v, val.data(), GMP_RNDN);
*e = v;
eval_ldexp(result, val, -v);
}
-template <unsigned Digits10>
-inline void eval_frexp(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& val, long* e) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_frexp(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& val, long* e) BOOST_NOEXCEPT
{
mpfr_get_d_2exp(e, val.data(), GMP_RNDN);
return eval_ldexp(result, val, -*e);
}
-template <unsigned Digits10>
-inline int eval_fpclassify(const mpfr_float_backend<Digits10>& val) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline int eval_fpclassify(const mpfr_float_backend<Digits10, AllocateType>& val) BOOST_NOEXCEPT
{
return mpfr_inf_p(val.data()) ? FP_INFINITE : mpfr_nan_p(val.data()) ? FP_NAN : mpfr_zero_p(val.data()) ? FP_ZERO : FP_NORMAL;
}
-template <unsigned Digits10>
-inline void eval_pow(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& b, const mpfr_float_backend<Digits10>& e) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_pow(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& b, const mpfr_float_backend<Digits10, AllocateType>& e) BOOST_NOEXCEPT
{
mpfr_pow(result.data(), b.data(), e.data(), GMP_RNDN);
}
@@ -970,99 +1241,99 @@
// certain other enable_if usages are defined first. It's a capricious
// and rather annoying compiler bug in other words....
//
-# define BOOST_MP_ENABLE_IF_WORKAROUND (Digits10 || !Digits10) &&
+# define BOOST_MP_ENABLE_IF_WORKAROUND (Digits10 || !Digits10) &&
#else
#define BOOST_MP_ENABLE_IF_WORKAROUND
#endif
-template <unsigned Digits10, class Integer>
-inline typename enable_if<mpl::and_<is_signed<Integer>, mpl::bool_<BOOST_MP_ENABLE_IF_WORKAROUND (sizeof(Integer) <= sizeof(long))> > >::type eval_pow(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& b, const Integer& e) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType, class Integer>
+inline typename enable_if<mpl::and_<is_signed<Integer>, mpl::bool_<BOOST_MP_ENABLE_IF_WORKAROUND (sizeof(Integer) <= sizeof(long))> > >::type eval_pow(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& b, const Integer& e) BOOST_NOEXCEPT
{
mpfr_pow_si(result.data(), b.data(), e, GMP_RNDN);
}
-template <unsigned Digits10, class Integer>
-inline typename enable_if<mpl::and_<is_unsigned<Integer>, mpl::bool_<BOOST_MP_ENABLE_IF_WORKAROUND (sizeof(Integer) <= sizeof(long))> > >::type eval_pow(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& b, const Integer& e) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType, class Integer>
+inline typename enable_if<mpl::and_<is_unsigned<Integer>, mpl::bool_<BOOST_MP_ENABLE_IF_WORKAROUND (sizeof(Integer) <= sizeof(long))> > >::type eval_pow(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& b, const Integer& e) BOOST_NOEXCEPT
{
mpfr_pow_ui(result.data(), b.data(), e, GMP_RNDN);
}
#undef BOOST_MP_ENABLE_IF_WORKAROUND
-template <unsigned Digits10>
-inline void eval_exp(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& arg) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_exp(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& arg) BOOST_NOEXCEPT
{
mpfr_exp(result.data(), arg.data(), GMP_RNDN);
}
-template <unsigned Digits10>
-inline void eval_log(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& arg) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_log(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& arg) BOOST_NOEXCEPT
{
mpfr_log(result.data(), arg.data(), GMP_RNDN);
}
-template <unsigned Digits10>
-inline void eval_log10(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& arg) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_log10(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& arg) BOOST_NOEXCEPT
{
mpfr_log10(result.data(), arg.data(), GMP_RNDN);
}
-template <unsigned Digits10>
-inline void eval_sin(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& arg) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_sin(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& arg) BOOST_NOEXCEPT
{
mpfr_sin(result.data(), arg.data(), GMP_RNDN);
}
-template <unsigned Digits10>
-inline void eval_cos(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& arg) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_cos(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& arg) BOOST_NOEXCEPT
{
mpfr_cos(result.data(), arg.data(), GMP_RNDN);
}
-template <unsigned Digits10>
-inline void eval_tan(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& arg) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_tan(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& arg) BOOST_NOEXCEPT
{
mpfr_tan(result.data(), arg.data(), GMP_RNDN);
}
-template <unsigned Digits10>
-inline void eval_asin(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& arg) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_asin(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& arg) BOOST_NOEXCEPT
{
mpfr_asin(result.data(), arg.data(), GMP_RNDN);
}
-template <unsigned Digits10>
-inline void eval_acos(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& arg) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_acos(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& arg) BOOST_NOEXCEPT
{
mpfr_acos(result.data(), arg.data(), GMP_RNDN);
}
-template <unsigned Digits10>
-inline void eval_atan(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& arg) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_atan(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& arg) BOOST_NOEXCEPT
{
mpfr_atan(result.data(), arg.data(), GMP_RNDN);
}
-template <unsigned Digits10>
-inline void eval_atan2(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& arg1, const mpfr_float_backend<Digits10>& arg2) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_atan2(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& arg1, const mpfr_float_backend<Digits10, AllocateType>& arg2) BOOST_NOEXCEPT
{
mpfr_atan2(result.data(), arg1.data(), arg2.data(), GMP_RNDN);
}
-template <unsigned Digits10>
-inline void eval_sinh(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& arg) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_sinh(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& arg) BOOST_NOEXCEPT
{
mpfr_sinh(result.data(), arg.data(), GMP_RNDN);
}
-template <unsigned Digits10>
-inline void eval_cosh(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& arg) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_cosh(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& arg) BOOST_NOEXCEPT
{
mpfr_cosh(result.data(), arg.data(), GMP_RNDN);
}
-template <unsigned Digits10>
-inline void eval_tanh(mpfr_float_backend<Digits10>& result, const mpfr_float_backend<Digits10>& arg) BOOST_NOEXCEPT
+template <unsigned Digits10, mpfr_allocation_type AllocateType>
+inline void eval_tanh(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& arg) BOOST_NOEXCEPT
{
mpfr_tanh(result.data(), arg.data(), GMP_RNDN);
}
@@ -1073,8 +1344,8 @@
namespace detail{
-template<unsigned D1, unsigned D2>
-struct is_explicitly_convertible<backends::mpfr_float_backend<D1>, backends::mpfr_float_backend<D2> > : public mpl::true_ {};
+template<unsigned D1, unsigned D2, mpfr_allocation_type A1, mpfr_allocation_type A2>
+struct is_explicitly_convertible<backends::mpfr_float_backend<D1, A1>, backends::mpfr_float_backend<D2, A2> > : public mpl::true_ {};
}
@@ -1091,6 +1362,9 @@
typedef number<mpfr_float_backend<1000> > mpfr_float_1000;
typedef number<mpfr_float_backend<0> > mpfr_float;
+typedef number<mpfr_float_backend<50, allocate_stack> > static_mpfr_float_50;
+typedef number<mpfr_float_backend<100, allocate_stack> > static_mpfr_float_100;
+
} // namespace multiprecision
namespace math{
@@ -1117,14 +1391,14 @@
//
// numeric_limits [partial] specializations for the types declared in this header:
//
-template<unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-class numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >
+template<unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+class numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >
{
- typedef boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> number_type;
+ typedef boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> number_type;
public:
BOOST_STATIC_CONSTEXPR bool is_specialized = true;
BOOST_STATIC_CONSTEXPR number_type (min)() BOOST_NOEXCEPT
- {
+ {
initializer.do_nothing();
static std::pair<bool, number_type> value;
if(!value.first)
@@ -1136,7 +1410,7 @@
return value.second;
}
BOOST_STATIC_CONSTEXPR number_type (max)() BOOST_NOEXCEPT
- {
+ {
initializer.do_nothing();
static std::pair<bool, number_type> value;
if(!value.first)
@@ -1159,8 +1433,8 @@
BOOST_STATIC_CONSTEXPR bool is_integer = false;
BOOST_STATIC_CONSTEXPR bool is_exact = false;
BOOST_STATIC_CONSTEXPR int radix = 2;
- BOOST_STATIC_CONSTEXPR number_type epsilon() BOOST_NOEXCEPT
- {
+ BOOST_STATIC_CONSTEXPR number_type epsilon() BOOST_NOEXCEPT
+ {
initializer.do_nothing();
static std::pair<bool, number_type> value;
if(!value.first)
@@ -1172,8 +1446,8 @@
return value.second;
}
// What value should this be????
- BOOST_STATIC_CONSTEXPR number_type round_error() BOOST_NOEXCEPT
- {
+ BOOST_STATIC_CONSTEXPR number_type round_error() BOOST_NOEXCEPT
+ {
// returns epsilon/2
initializer.do_nothing();
static std::pair<bool, number_type> value;
@@ -1194,8 +1468,8 @@
BOOST_STATIC_CONSTEXPR bool has_signaling_NaN = false;
BOOST_STATIC_CONSTEXPR float_denorm_style has_denorm = denorm_absent;
BOOST_STATIC_CONSTEXPR bool has_denorm_loss = false;
- BOOST_STATIC_CONSTEXPR number_type infinity() BOOST_NOEXCEPT
- {
+ BOOST_STATIC_CONSTEXPR number_type infinity() BOOST_NOEXCEPT
+ {
// returns epsilon/2
initializer.do_nothing();
static std::pair<bool, number_type> value;
@@ -1207,8 +1481,8 @@
}
return value.second;
}
- BOOST_STATIC_CONSTEXPR number_type quiet_NaN() BOOST_NOEXCEPT
- {
+ BOOST_STATIC_CONSTEXPR number_type quiet_NaN() BOOST_NOEXCEPT
+ {
// returns epsilon/2
initializer.do_nothing();
static std::pair<bool, number_type> value;
@@ -1220,9 +1494,9 @@
}
return value.second;
}
- BOOST_STATIC_CONSTEXPR number_type signaling_NaN() BOOST_NOEXCEPT
- {
- return number_type(0);
+ BOOST_STATIC_CONSTEXPR number_type signaling_NaN() BOOST_NOEXCEPT
+ {
+ return number_type(0);
}
BOOST_STATIC_CONSTEXPR number_type denorm_min() BOOST_NOEXCEPT { return number_type(0); }
BOOST_STATIC_CONSTEXPR bool is_iec559 = false;
@@ -1237,72 +1511,72 @@
{
data_initializer()
{
- std::numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<digits10> > >::epsilon();
- std::numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<digits10> > >::round_error();
- (std::numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<digits10> > >::min)();
- (std::numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<digits10> > >::max)();
- std::numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<digits10> > >::infinity();
- std::numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<digits10> > >::quiet_NaN();
+ std::numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<digits10, AllocateType> > >::epsilon();
+ std::numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<digits10, AllocateType> > >::round_error();
+ (std::numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<digits10, AllocateType> > >::min)();
+ (std::numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<digits10, AllocateType> > >::max)();
+ std::numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<digits10, AllocateType> > >::infinity();
+ std::numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<digits10, AllocateType> > >::quiet_NaN();
}
void do_nothing()const{}
};
static const data_initializer initializer;
};
-template<unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-const typename numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::data_initializer numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::initializer;
+template<unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+const typename numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::data_initializer numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::initializer;
#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::digits;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::digits10;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::max_digits10;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::is_signed;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::is_integer;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::is_exact;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::radix;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST long numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::min_exponent;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST long numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::min_exponent10;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST long numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::max_exponent;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST long numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::max_exponent10;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::has_infinity;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::has_quiet_NaN;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::has_signaling_NaN;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST float_denorm_style numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::has_denorm;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::has_denorm_loss;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::is_iec559;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::is_bounded;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::is_modulo;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::traps;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::tinyness_before;
-template <unsigned Digits10, boost::multiprecision::expression_template_option ExpressionTemplates>
-BOOST_CONSTEXPR_OR_CONST float_round_style numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::round_style;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::digits;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::digits10;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::max_digits10;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::is_signed;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::is_integer;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::is_exact;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST int numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::radix;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST long numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::min_exponent;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST long numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::min_exponent10;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST long numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::max_exponent;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST long numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::max_exponent10;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::has_infinity;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::has_quiet_NaN;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::has_signaling_NaN;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST float_denorm_style numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::has_denorm;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::has_denorm_loss;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::is_iec559;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::is_bounded;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::is_modulo;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::traps;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST bool numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::tinyness_before;
+template <unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
+BOOST_CONSTEXPR_OR_CONST float_round_style numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >::round_style;
#endif
-template<boost::multiprecision::expression_template_option ExpressionTemplates>
+template<boost::multiprecision::expression_template_option ExpressionTemplates>
class numeric_limits<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<0>, ExpressionTemplates> >
{
typedef boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<0>, ExpressionTemplates> number_type;
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html 2012-11-01 15:01:08 EDT (Thu, 01 Nov 2012)
@@ -13,9 +13,9 @@
<div class="spirit-nav">
<a accesskey="p" href="../indexes.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s02.html"><img src="../../images/next.png" alt="Next"></a>
</div>
-<div class="section id971892">
+<div class="section id964891">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id971892"></a>Function Index</h3></div></div></div>
+<a name="id964891"></a>Function Index</h3></div></div></div>
<p><a class="link" href="s01.html#idx_id_0">A</a> <a class="link" href="s01.html#idx_id_1">B</a> <a class="link" href="s01.html#idx_id_2">C</a> <a class="link" href="s01.html#idx_id_3">D</a> <a class="link" href="s01.html#idx_id_4">E</a> <a class="link" href="s01.html#idx_id_5">F</a> <a class="link" href="s01.html#idx_id_7">I</a> <a class="link" href="s01.html#idx_id_8">L</a> <a class="link" href="s01.html#idx_id_9">M</a> <a class="link" href="s01.html#idx_id_12">P</a> <a class="link" href="s01.html#idx_id_13">R</a> <a class="link" href="s01.html#idx_id_14">S</a> <a class="link" href="s01.html#idx_id_15">T</a> <a class="link" href="s01.html#idx_id_17">Z</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html 2012-11-01 15:01:08 EDT (Thu, 01 Nov 2012)
@@ -13,9 +13,9 @@
<div class="spirit-nav">
<a accesskey="p" href="s01.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s03.html"><img src="../../images/next.png" alt="Next"></a>
</div>
-<div class="section id975922">
+<div class="section id966945">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id975922"></a>Class Index</h3></div></div></div>
+<a name="id966945"></a>Class Index</h3></div></div></div>
<p><a class="link" href="s02.html#idx_id_20">C</a> <a class="link" href="s02.html#idx_id_22">E</a> <a class="link" href="s02.html#idx_id_24">G</a> <a class="link" href="s02.html#idx_id_25">I</a> <a class="link" href="s02.html#idx_id_27">M</a> <a class="link" href="s02.html#idx_id_28">N</a> <a class="link" href="s02.html#idx_id_33">T</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html 2012-11-01 15:01:08 EDT (Thu, 01 Nov 2012)
@@ -13,10 +13,10 @@
<div class="spirit-nav">
<a accesskey="p" href="s02.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s04.html"><img src="../../images/next.png" alt="Next"></a>
</div>
-<div class="section id978047">
+<div class="section id969084">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id978047"></a>Typedef Index</h3></div></div></div>
-<p><a class="link" href="s03.html#idx_id_38">C</a> <a class="link" href="s03.html#idx_id_43">I</a> <a class="link" href="s03.html#idx_id_44">L</a> <a class="link" href="s03.html#idx_id_45">M</a> <a class="link" href="s03.html#idx_id_51">T</a> <a class="link" href="s03.html#idx_id_52">U</a></p>
+<a name="id969084"></a>Typedef Index</h3></div></div></div>
+<p><a class="link" href="s03.html#idx_id_38">C</a> <a class="link" href="s03.html#idx_id_43">I</a> <a class="link" href="s03.html#idx_id_44">L</a> <a class="link" href="s03.html#idx_id_45">M</a> <a class="link" href="s03.html#idx_id_50">S</a> <a class="link" href="s03.html#idx_id_51">T</a> <a class="link" href="s03.html#idx_id_52">U</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
<a name="idx_id_38"></a><span class="term">C</span>
@@ -198,6 +198,19 @@
</li>
</ul></div></dd>
<dt>
+<a name="idx_id_50"></a><span class="term">S</span>
+</dt>
+<dd><div class="index"><ul class="index" style="list-style-type: none; ">
+<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">static_mpfr_float_100</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/mpfr_float.html" title="mpfr_float"><span class="index-entry-level-1">mpfr_float</span></a></p></li></ul></div>
+</li>
+<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">static_mpfr_float_50</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/mpfr_float.html" title="mpfr_float"><span class="index-entry-level-1">mpfr_float</span></a></p></li></ul></div>
+</li>
+</ul></div></dd>
+<dt>
<a name="idx_id_51"></a><span class="term">T</span>
</dt>
<dd><div class="index"><ul class="index" style="list-style-type: none; ">
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html 2012-11-01 15:01:08 EDT (Thu, 01 Nov 2012)
@@ -12,9 +12,9 @@
<div class="spirit-nav">
<a accesskey="p" href="s03.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a>
</div>
-<div class="section id978993">
+<div class="section id970084">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id978993"></a>Index</h3></div></div></div>
+<a name="id970084"></a>Index</h3></div></div></div>
<p><a class="link" href="s04.html#idx_id_54">A</a> <a class="link" href="s04.html#idx_id_55">B</a> <a class="link" href="s04.html#idx_id_56">C</a> <a class="link" href="s04.html#idx_id_57">D</a> <a class="link" href="s04.html#idx_id_58">E</a> <a class="link" href="s04.html#idx_id_59">F</a> <a class="link" href="s04.html#idx_id_60">G</a> <a class="link" href="s04.html#idx_id_61">I</a> <a class="link" href="s04.html#idx_id_62">L</a> <a class="link" href="s04.html#idx_id_63">M</a> <a class="link" href="s04.html#idx_id_64">N</a> <a class="link" href="s04.html#idx_id_65">O</a> <a class="link" href="s04.html#idx_id_66">P</a> <a class="link" href="s04.html#idx_id_67">R</a> <a class="link" href="s04.html#idx_id_68">S</a> <a class="link" href="s04.html#idx_id_69">T</a> <a class="link" href="s04.html#idx_id_70">U</a> <a class="link" href="s04.html#idx_id_71">Z</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
@@ -670,6 +670,8 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/mpfr_float.html" title="mpfr_float"><span class="index-entry-level-1">mpfr_float_50</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/mpfr_float.html" title="mpfr_float"><span class="index-entry-level-1">mpfr_float_500</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/mpfr_float.html" title="mpfr_float"><span class="index-entry-level-1">mpfr_float_backend</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/mpfr_float.html" title="mpfr_float"><span class="index-entry-level-1">static_mpfr_float_100</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/mpfr_float.html" title="mpfr_float"><span class="index-entry-level-1">static_mpfr_float_50</span></a></p></li>
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
@@ -897,6 +899,14 @@
</dt>
<dd><div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">static_mpfr_float_100</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/mpfr_float.html" title="mpfr_float"><span class="index-entry-level-1">mpfr_float</span></a></p></li></ul></div>
+</li>
+<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">static_mpfr_float_50</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/mpfr_float.html" title="mpfr_float"><span class="index-entry-level-1">mpfr_float</span></a></p></li></ul></div>
+</li>
+<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">str</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li></ul></div>
</li>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html 2012-11-01 15:01:08 EDT (Thu, 01 Nov 2012)
@@ -59,6 +59,10 @@
Refactored <code class="computeroutput"><span class="identifier">cpp_int_backend</span></code>
based on review comments with new template parameter structure.
</li>
+<li class="listitem">
+ Added additional template parameter to <code class="computeroutput"><span class="identifier">mpfr_float_backend</span></code>
+ to allow stack-based allocation.
+ </li>
</ul></div>
<h5>
<a name="boost_multiprecision.map.hist.h1"></a>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/mpfr_float.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/mpfr_float.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/mpfr_float.html 2012-11-01 15:01:08 EDT (Thu, 01 Nov 2012)
@@ -22,7 +22,13 @@
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">multiprecision</span><span class="special">{</span>
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">unsigned</span> <span class="identifier">Digits10</span><span class="special">></span>
+<span class="keyword">enum</span> <span class="identifier">mpfr_allocation_type</span>
+<span class="special">{</span>
+ <span class="identifier">allocate_stack</span><span class="special">,</span>
+ <span class="identifier">allocate_dynamic</span>
+<span class="special">};</span>
+
+<span class="keyword">template</span> <span class="special"><</span><span class="keyword">unsigned</span> <span class="identifier">Digits10</span><span class="special">,</span> <span class="identifier">mpfr_allocation_type</span> <span class="identifier">AllocateType</span> <span class="special">=</span> <span class="identifier">allocate_dynamic</span><span class="special">></span>
<span class="keyword">class</span> <span class="identifier">mpfr_float_backend</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">mpfr_float_backend</span><span class="special"><</span><span class="number">50</span><span class="special">></span> <span class="special">></span> <span class="identifier">mpfr_float_50</span><span class="special">;</span>
@@ -31,6 +37,9 @@
<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">mpfr_float_backend</span><span class="special"><</span><span class="number">1000</span><span class="special">></span> <span class="special">></span> <span class="identifier">mpfr_float_1000</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">mpfr_float_backend</span><span class="special"><</span><span class="number">0</span><span class="special">></span> <span class="special">></span> <span class="identifier">mpfr_float</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">mpfr_float_backend</span><span class="special"><</span><span class="number">50</span><span class="special">,</span> <span class="identifier">allocate_stack</span><span class="special">></span> <span class="special">></span> <span class="identifier">static_mpfr_float_50</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">mpfr_float_backend</span><span class="special"><</span><span class="number">100</span><span class="special">,</span> <span class="identifier">allocate_stack</span><span class="special">></span> <span class="special">></span> <span class="identifier">static_mpfr_float_100</span><span class="special">;</span>
+
<span class="special">}}</span> <span class="comment">// namespaces</span>
</pre>
<p>
@@ -51,6 +60,18 @@
whose precision can be controlled via the <code class="computeroutput"><span class="identifier">number</span></code>s
member functions.
</p>
+<p>
+ In addition the second template parameter lets you choose between dynamic
+ allocation (the default, and uses MPFR's normal allocation routines), or
+ stack allocation (where all the memory required for the underlying data
+ types is stored within <code class="computeroutput"><span class="identifier">mpfr_float_backend</span></code>).
+ The latter option can result in significantly faster code, at the expense
+ of growing the size of <code class="computeroutput"><span class="identifier">mpfr_float_backend</span></code>.
+ It can only be used at fixed precision, and should only be used for lower
+ digit counts. Note that we can not guarentee that using <code class="computeroutput"><span class="identifier">allocate_stack</span></code>
+ won't cause any calls to mpfr's allocation routines, as mpfr may call these
+ inside it's own code.
+ </p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../images/note.png"></td>
Modified: sandbox/big_number/libs/multiprecision/doc/html/index.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/index.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/index.html 2012-11-01 15:01:08 EDT (Thu, 01 Nov 2012)
@@ -124,7 +124,7 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: November 01, 2012 at 11:12:34 GMT</small></p></td>
+<td align="left"><p><small>Last revised: November 01, 2012 at 18:56:42 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Modified: sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk (original)
+++ sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk 2012-11-01 15:01:08 EDT (Thu, 01 Nov 2012)
@@ -730,7 +730,13 @@
namespace boost{ namespace multiprecision{
- template <unsigned Digits10>
+ enum mpfr_allocation_type
+ {
+ allocate_stack,
+ allocate_dynamic
+ };
+
+ template <unsigned Digits10, mpfr_allocation_type AllocateType = allocate_dynamic>
class mpfr_float_backend;
typedef number<mpfr_float_backend<50> > mpfr_float_50;
@@ -739,6 +745,9 @@
typedef number<mpfr_float_backend<1000> > mpfr_float_1000;
typedef number<mpfr_float_backend<0> > mpfr_float;
+ typedef number<mpfr_float_backend<50, allocate_stack> > static_mpfr_float_50;
+ typedef number<mpfr_float_backend<100, allocate_stack> > static_mpfr_float_100;
+
}} // namespaces
The `mpfr_float_backend` type is used in conjunction with `number`: It acts as a thin wrapper around the [mpfr] `mpfr_t`
@@ -751,6 +760,14 @@
respectively. The typedef mpfr_float provides a variable precision type whose precision can be controlled via the
`number`s member functions.
+In addition the second template parameter lets you choose between dynamic allocation (the default,
+and uses MPFR's normal allocation routines),
+or stack allocation (where all the memory required for the underlying data types is stored
+within `mpfr_float_backend`). The latter option can result in significantly faster code, at the
+expense of growing the size of `mpfr_float_backend`. It can only be used at fixed precision, and
+should only be used for lower digit counts. Note that we can not guarentee that using `allocate_stack`
+won't cause any calls to mpfr's allocation routines, as mpfr may call these inside it's own code.
+
[note This type only provides `numeric_limits` support when the precision is fixed at compile time.]
As well as the usual conversions from arithmetic and string types, instances of `number<mpfr_float_backend<N> >` are
@@ -2897,6 +2914,7 @@
* Added support for fused-multiply-add/subtract with GMP support.
* Tweaked expression template unpacking to use fewer temporaries when the LHS also appears in the RHS.
* Refactored `cpp_int_backend` based on review comments with new template parameter structure.
+* Added additional template parameter to `mpfr_float_backend` to allow stack-based allocation.
[h4 Pre-review history]
Modified: sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp 2012-11-01 15:01:08 EDT (Thu, 01 Nov 2012)
@@ -1839,6 +1839,7 @@
#endif
#ifdef TEST_MPFR_50
test<boost::multiprecision::mpfr_float_50>();
+ test<boost::multiprecision::static_mpfr_float_50>();
#endif
#ifdef TEST_TOMMATH
test<boost::multiprecision::tom_int>();
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