Boost logo

Boost-Commit :

From: john_at_[hidden]
Date: 2007-09-13 12:56:32


Author: johnmaddock
Date: 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
New Revision: 39239
URL: http://svn.boost.org/trac/boost/changeset/39239

Log:
Updated NTL::RR support with a thin wrapper class: RR can now be used unmodified via the supplied wrapper.
Added:
   sandbox/math_toolkit/boost/math/bindings/
   sandbox/math_toolkit/boost/math/bindings/rr.hpp (contents, props changed)
   sandbox/math_toolkit/libs/math/tools/process_perf_results.cpp (contents, props changed)
Removed:
   sandbox/math_toolkit/boost/math/tools/ntl.hpp
Text files modified:
   sandbox/math_toolkit/libs/math/doc/concepts.qbk | 35 +-
   sandbox/math_toolkit/libs/math/minimax/f.cpp | 94 +++---
   sandbox/math_toolkit/libs/math/minimax/main.cpp | 74 ++--
   sandbox/math_toolkit/libs/math/tools/bessel_data.cpp | 56 ++--
   sandbox/math_toolkit/libs/math/tools/beta_data.cpp | 14
   sandbox/math_toolkit/libs/math/tools/carlson_ellint_data.cpp | 54 ++--
   sandbox/math_toolkit/libs/math/tools/cbrt_data.cpp | 14
   sandbox/math_toolkit/libs/math/tools/digamma_data.cpp | 10
   sandbox/math_toolkit/libs/math/tools/ellint_e_data.cpp | 12
   sandbox/math_toolkit/libs/math/tools/ellint_f_data.cpp | 12
   sandbox/math_toolkit/libs/math/tools/ellint_k_data.cpp | 12
   sandbox/math_toolkit/libs/math/tools/ellint_pi2_data.cpp | 14
   sandbox/math_toolkit/libs/math/tools/ellint_pi3_data.cpp | 18
   sandbox/math_toolkit/libs/math/tools/erf_data.cpp | 40 +-
   sandbox/math_toolkit/libs/math/tools/factorial_tables.cpp | 12
   sandbox/math_toolkit/libs/math/tools/gamma_P_inva_data.cpp | 22
   sandbox/math_toolkit/libs/math/tools/generate_rational_test.cpp | 66 ++--
   sandbox/math_toolkit/libs/math/tools/hermite_data.cpp | 14
   sandbox/math_toolkit/libs/math/tools/ibeta_data.cpp | 76 ++--
   sandbox/math_toolkit/libs/math/tools/ibeta_inv_data.cpp | 28 +-
   sandbox/math_toolkit/libs/math/tools/ibeta_invab_data.cpp | 32 +-
   sandbox/math_toolkit/libs/math/tools/igamma_data.cpp | 44 +-
   sandbox/math_toolkit/libs/math/tools/igamma_temme_large_coef.cpp | 24
   sandbox/math_toolkit/libs/math/tools/laguerre_data.cpp | 14
   sandbox/math_toolkit/libs/math/tools/lanczos_generator.cpp | 46 +-
   sandbox/math_toolkit/libs/math/tools/legendre_data.cpp | 14
   sandbox/math_toolkit/libs/math/tools/log1p_expm1_data.cpp | 12
   sandbox/math_toolkit/libs/math/tools/ntl_rr_digamma.hpp | 507 +++++++++++++++++++--------------------
   sandbox/math_toolkit/libs/math/tools/ntl_rr_lanczos.hpp | 4
   sandbox/math_toolkit/libs/math/tools/rational_tests.cpp | 46 +-
   sandbox/math_toolkit/libs/math/tools/spherical_harmonic_data.cpp | 12
   sandbox/math_toolkit/libs/math/tools/tgamma_ratio_data.cpp | 22
   32 files changed, 722 insertions(+), 732 deletions(-)

Added: sandbox/math_toolkit/boost/math/bindings/rr.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/boost/math/bindings/rr.hpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -0,0 +1,702 @@
+// Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <boost/config.hpp>
+#include <boost/limits.hpp>
+#include <boost/math/tools/real_cast.hpp>
+#include <boost/math/tools/precision.hpp>
+#include <boost/math/constants/constants.hpp>
+#include <boost/math/tools/roots.hpp>
+#include <boost/math/special_functions/fpclassify.hpp>
+
+#include <ostream>
+#include <istream>
+#include <cmath>
+#include <ntl/rr.h>
+
+#ifndef BOOST_MATH_NTL_RR_HPP
+#define BOOST_MATH_NTL_RR_HPP
+
+namespace boost{ namespace math{
+
+namespace ntl
+{
+
+class RR
+{
+public:
+ // Constructors:
+ RR() {}
+ RR(const ::NTL::RR& c) : m_value(c){}
+ RR(char c)
+ {
+ m_value = c;
+ }
+#ifndef BOOST_NO_INTRINSIC_WCHAR_T
+ RR(wchar_t c)
+ {
+ m_value = c;
+ }
+#endif
+ RR(unsigned char c)
+ {
+ m_value = c;
+ }
+ RR(signed char c)
+ {
+ m_value = c;
+ }
+ RR(unsigned short c)
+ {
+ m_value = c;
+ }
+ RR(short c)
+ {
+ m_value = c;
+ }
+ RR(unsigned int c)
+ {
+ assign_large_int(c);
+ }
+ RR(int c)
+ {
+ assign_large_int(c);
+ }
+ RR(unsigned long c)
+ {
+ assign_large_int(c);
+ }
+ RR(long c)
+ {
+ assign_large_int(c);
+ }
+#ifdef BOOST_HAS_LONG_LONG
+ RR(unsigned long long c)
+ {
+ assign_large_int(c);
+ }
+ RR(long long c)
+ {
+ assign_large_int(c);
+ }
+#endif
+ RR(float c)
+ {
+ m_value = c;
+ }
+ RR(double c)
+ {
+ m_value = c;
+ }
+ RR(long double c)
+ {
+ assign_large_real(c);
+ }
+
+ // Assignment:
+ RR& operator=(char c) { m_value = c; return *this; }
+ RR& operator=(unsigned char c) { m_value = c; return *this; }
+ RR& operator=(signed char c) { m_value = c; return *this; }
+#ifndef BOOST_NO_INTRINSIC_WCHAR_T
+ RR& operator=(wchar_t c) { m_value = c; return *this; }
+#endif
+ RR& operator=(short c) { m_value = c; return *this; }
+ RR& operator=(unsigned short c) { m_value = c; return *this; }
+ RR& operator=(int c) { assign_large_int(c); return *this; }
+ RR& operator=(unsigned int c) { assign_large_int(c); return *this; }
+ RR& operator=(long c) { assign_large_int(c); return *this; }
+ RR& operator=(unsigned long c) { assign_large_int(c); return *this; }
+#ifdef BOOST_HAS_LONG_LONG
+ RR& operator=(long long c) { assign_large_int(c); return *this; }
+ RR& operator=(unsigned long long c) { assign_large_int(c); return *this; }
+#endif
+ RR& operator=(float c) { m_value = c; return *this; }
+ RR& operator=(double c) { m_value = c; return *this; }
+ RR& operator=(long double c) { assign_large_real(c); return *this; }
+
+ // Access:
+ NTL::RR& value(){ return m_value; }
+ NTL::RR const& value()const{ return m_value; }
+
+ // Member arithmetic:
+ RR& operator+=(const RR& other)
+ { m_value += other.value(); return *this; }
+ RR& operator-=(const RR& other)
+ { m_value -= other.value(); return *this; }
+ RR& operator*=(const RR& other)
+ { m_value *= other.value(); return *this; }
+ RR& operator/=(const RR& other)
+ { m_value /= other.value(); return *this; }
+ RR operator-()const
+ { return -m_value; }
+ RR const& operator+()const
+ { return *this; }
+
+ // RR compatibity:
+ const ::NTL::ZZ& mantissa() const
+ { return m_value.mantissa(); }
+ long exponent() const
+ { return m_value.exponent(); }
+
+ static void SetPrecision(long p)
+ { ::NTL::RR::SetPrecision(p); }
+
+ static long precision()
+ { return ::NTL::RR::precision(); }
+
+ static void SetOutputPrecision(long p)
+ { ::NTL::RR::SetOutputPrecision(p); }
+ static long OutputPrecision()
+ { return ::NTL::RR::OutputPrecision(); }
+
+
+private:
+ ::NTL::RR m_value;
+
+ template <class V>
+ void assign_large_real(const V& a)
+ {
+ using std::frexp;
+ using std::ldexp;
+ using std::floor;
+ if (a == 0) {
+ clear(m_value);
+ return;
+ }
+
+ if (a == 1) {
+ NTL::set(m_value);
+ return;
+ }
+
+ if (!(boost::math::isfinite)(a))
+ {
+ throw std::overflow_error("Cannot construct an instance of NTL::RR with an infinite value.");
+ }
+
+ int e;
+ long double f, term;
+ ::NTL::RR t;
+ clear(m_value);
+
+ f = frexp(a, &e);
+
+ while(f)
+ {
+ // extract 30 bits from f:
+ f = ldexp(f, 30);
+ term = floor(f);
+ e -= 30;
+ conv(t.x, (int)term);
+ t.e = e;
+ m_value += t;
+ f -= term;
+ }
+ }
+
+ template <class V>
+ void assign_large_int(V a)
+ {
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4146)
+#endif
+ clear(m_value);
+ int exp = 0;
+ NTL::RR t;
+ bool neg = a < V(0) ? true : false;
+ if(neg)
+ a = -a;
+ while(a)
+ {
+ t = static_cast<double>(a & 0xffff);
+ m_value += ldexp(RR(t), exp).value();
+ a >>= 16;
+ exp += 16;
+ }
+ if(neg)
+ m_value = -m_value;
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+ }
+};
+
+// Non-member arithmetic:
+inline RR operator+(const RR& a, const RR& b)
+{
+ RR result(a);
+ result += b;
+ return result;
+}
+inline RR operator-(const RR& a, const RR& b)
+{
+ RR result(a);
+ result -= b;
+ return result;
+}
+inline RR operator*(const RR& a, const RR& b)
+{
+ RR result(a);
+ result *= b;
+ return result;
+}
+inline RR operator/(const RR& a, const RR& b)
+{
+ RR result(a);
+ result /= b;
+ return result;
+}
+
+// Comparison:
+inline bool operator == (const RR& a, const RR& b)
+{ return a.value() == b.value() ? true : false; }
+inline bool operator != (const RR& a, const RR& b)
+{ return a.value() != b.value() ? true : false;}
+inline bool operator < (const RR& a, const RR& b)
+{ return a.value() < b.value() ? true : false; }
+inline bool operator <= (const RR& a, const RR& b)
+{ return a.value() <= b.value() ? true : false; }
+inline bool operator > (const RR& a, const RR& b)
+{ return a.value() > b.value() ? true : false; }
+inline bool operator >= (const RR& a, const RR& b)
+{ return a.value() >= b.value() ? true : false; }
+
+#if 0
+// Non-member mixed compare:
+template <class T>
+inline bool operator == (const T& a, const RR& b)
+{
+ return a == b.value();
+}
+template <class T>
+inline bool operator != (const T& a, const RR& b)
+{
+ return a != b.value();
+}
+template <class T>
+inline bool operator < (const T& a, const RR& b)
+{
+ return a < b.value();
+}
+template <class T>
+inline bool operator > (const T& a, const RR& b)
+{
+ return a > b.value();
+}
+template <class T>
+inline bool operator <= (const T& a, const RR& b)
+{
+ return a <= b.value();
+}
+template <class T>
+inline bool operator >= (const T& a, const RR& b)
+{
+ return a >= b.value();
+}
+#endif // Non-member mixed compare:
+
+// Non-member functions:
+/*
+inline RR acos(RR a)
+{ return ::NTL::acos(a.value()); }
+*/
+inline RR cos(RR a)
+{ return ::NTL::cos(a.value()); }
+/*
+inline RR asin(RR a)
+{ return ::NTL::asin(a.value()); }
+inline RR atan(RR a)
+{ return ::NTL::atan(a.value()); }
+inline RR atan2(RR a, RR b)
+{ return ::NTL::atan2(a.value(), b.value()); }
+*/
+inline RR ceil(RR a)
+{ return ::NTL::ceil(a.value()); }
+/*
+inline RR fmod(RR a, RR b)
+{ return ::NTL::fmod(a.value(), b.value()); }
+inline RR cosh(RR a)
+{ return ::NTL::cosh(a.value()); }
+*/
+inline RR exp(RR a)
+{ return ::NTL::exp(a.value()); }
+inline RR fabs(RR a)
+{ return ::NTL::fabs(a.value()); }
+inline RR abs(RR a)
+{ return ::NTL::abs(a.value()); }
+inline RR floor(RR a)
+{ return ::NTL::floor(a.value()); }
+/*
+inline RR modf(RR a, RR* ipart)
+{
+ ::NTL::RR ip;
+ RR result = modf(a.value(), &ip);
+ *ipart = ip;
+ return result;
+}
+inline RR frexp(RR a, int* expon)
+{ return ::NTL::frexp(a.value(), expon); }
+inline RR ldexp(RR a, int expon)
+{ return ::NTL::ldexp(a.value(), expon); }
+*/
+inline RR log(RR a)
+{ return ::NTL::log(a.value()); }
+inline RR log10(RR a)
+{ return ::NTL::log10(a.value()); }
+/*
+inline RR tan(RR a)
+{ return ::NTL::tan(a.value()); }
+*/
+inline RR pow(RR a, RR b)
+{ return ::NTL::pow(a.value(), b.value()); }
+inline RR pow(RR a, int b)
+{ return ::NTL::power(a.value(), b); }
+inline RR sin(RR a)
+{ return ::NTL::sin(a.value()); }
+/*
+inline RR sinh(RR a)
+{ return ::NTL::sinh(a.value()); }
+*/
+inline RR sqrt(RR a)
+{ return ::NTL::sqrt(a.value()); }
+/*
+inline RR tanh(RR a)
+{ return ::NTL::tanh(a.value()); }
+*/
+ inline RR pow(const RR& r, long l)
+ {
+ return ::NTL::power(r.value(), l);
+ }
+ inline RR tan(const RR& a)
+ {
+ return sin(a)/cos(a);
+ }
+ inline RR frexp(RR r, int* exp)
+ {
+ *exp = r.value().e;
+ r.value().e = 0;
+ while(r >= 1)
+ {
+ *exp += 1;
+ r.value().e -= 1;
+ }
+ while(r < 0.5)
+ {
+ *exp -= 1;
+ r.value().e += 1;
+ }
+ BOOST_ASSERT(r < 1);
+ BOOST_ASSERT(r >= 0.5);
+ return r;
+ }
+ inline RR ldexp(RR r, int exp)
+ {
+ r.value().e += exp;
+ return r;
+ }
+
+// Streaming:
+template <class charT, class traits>
+inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& os, const RR& a)
+{
+ return os << a.value();
+}
+template <class charT, class traits>
+inline std::basic_istream<charT, traits>& operator>>(std::basic_istream<charT, traits>& is, RR& a)
+{
+ long double v;
+ is >> v;
+ a = v;
+ return is;
+}
+
+} // namespace ntl
+
+namespace tools
+{
+
+template<>
+inline int digits<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
+{
+ return ::NTL::RR::precision();
+}
+
+template <>
+inline float real_cast<float, boost::math::ntl::RR>(boost::math::ntl::RR t)
+{
+ double r;
+ conv(r, t.value());
+ return static_cast<float>(r);
+}
+template <>
+inline double real_cast<double, boost::math::ntl::RR>(boost::math::ntl::RR t)
+{
+ double r;
+ conv(r, t.value());
+ return r;
+}
+
+namespace detail{
+
+template<class I>
+void convert_to_long_result(NTL::RR const& r, I& result)
+{
+ result = 0;
+ I last_result(0);
+ NTL::RR t(r);
+ double term;
+ do
+ {
+ conv(term, t);
+ last_result = result;
+ result += static_cast<I>(term);
+ t -= term;
+ }while(result != last_result);
+}
+
+}
+
+template <>
+inline long double real_cast<long double, boost::math::ntl::RR>(boost::math::ntl::RR t)
+{
+ long double result(0);
+ detail::convert_to_long_result(t.value(), result);
+ return result;
+}
+template <>
+inline boost::math::ntl::RR real_cast<boost::math::ntl::RR, boost::math::ntl::RR>(boost::math::ntl::RR t)
+{
+ return t;
+}
+template <>
+inline unsigned real_cast<unsigned, boost::math::ntl::RR>(boost::math::ntl::RR t)
+{
+ unsigned result;
+ detail::convert_to_long_result(t.value(), result);
+ return result;
+}
+template <>
+inline int real_cast<int, boost::math::ntl::RR>(boost::math::ntl::RR t)
+{
+ unsigned result;
+ detail::convert_to_long_result(t.value(), result);
+ return result;
+}
+
+template <>
+inline boost::math::ntl::RR max_value<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
+{
+ static bool has_init = false;
+ static NTL::RR val;
+ if(!has_init)
+ {
+ val = 1;
+ val.e = NTL_OVFBND-20;
+ has_init = true;
+ }
+ return val;
+}
+
+template <>
+inline boost::math::ntl::RR min_value<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
+{
+ static bool has_init = false;
+ static NTL::RR val;
+ if(!has_init)
+ {
+ val = 1;
+ val.e = -NTL_OVFBND+20;
+ has_init = true;
+ }
+ return val;
+}
+
+template <>
+inline boost::math::ntl::RR log_max_value<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
+{
+ static bool has_init = false;
+ static NTL::RR val;
+ if(!has_init)
+ {
+ val = 1;
+ val.e = NTL_OVFBND-20;
+ val = log(val);
+ has_init = true;
+ }
+ return val;
+}
+
+template <>
+inline boost::math::ntl::RR log_min_value<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
+{
+ static bool has_init = false;
+ static NTL::RR val;
+ if(!has_init)
+ {
+ val = 1;
+ val.e = -NTL_OVFBND+20;
+ val = log(val);
+ has_init = true;
+ }
+ return val;
+}
+
+template <>
+inline boost::math::ntl::RR epsilon<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
+{
+ return ldexp(boost::math::ntl::RR(1), 1-boost::math::policies::digits<boost::math::ntl::RR, boost::math::policies::policy<> >());
+}
+
+} // namespace tools
+
+//
+// The number of digits precision in RR can vary with each call
+// so we need to recalculate these with each call:
+//
+namespace constants{
+
+template<> inline boost::math::ntl::RR pi<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
+{
+ NTL::RR result;
+ ComputePi(result);
+ return result;
+}
+template<> inline boost::math::ntl::RR e<boost::math::ntl::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(boost::math::ntl::RR))
+{
+ NTL::RR result;
+ result = 1;
+ return exp(result);
+}
+
+} // namespace constants
+
+namespace ntl{
+ //
+ // These are some fairly brain-dead versions of the math
+ // functions that NTL fails to provide.
+ //
+
+
+ //
+ // Inverse trig functions:
+ //
+ struct asin_root
+ {
+ asin_root(RR const& target) : t(target){}
+
+ std::tr1::tuple<RR, RR, RR> operator()(RR const& p)
+ {
+ RR f0 = sin(p);
+ RR f1 = cos(p);
+ RR f2 = -f0;
+ f0 -= t;
+ return std::tr1::make_tuple(f0, f1, f2);
+ }
+ private:
+ RR t;
+ };
+
+ inline RR asin(RR z)
+ {
+ double r;
+ conv(r, z.value());
+ return boost::math::tools::halley_iterate(
+ asin_root(z),
+ RR(std::asin(r)),
+ RR(-boost::math::constants::pi<RR>()/2),
+ RR(boost::math::constants::pi<RR>()/2),
+ NTL::RR::precision());
+ }
+
+ struct acos_root
+ {
+ acos_root(RR const& target) : t(target){}
+
+ std::tr1::tuple<RR, RR, RR> operator()(RR const& p)
+ {
+ RR f0 = cos(p);
+ RR f1 = -sin(p);
+ RR f2 = -f0;
+ f0 -= t;
+ return std::tr1::make_tuple(f0, f1, f2);
+ }
+ private:
+ RR t;
+ };
+
+ inline RR acos(RR z)
+ {
+ double r;
+ conv(r, z.value());
+ return boost::math::tools::halley_iterate(
+ acos_root(z),
+ RR(std::acos(r)),
+ RR(-boost::math::constants::pi<RR>()/2),
+ RR(boost::math::constants::pi<RR>()/2),
+ NTL::RR::precision());
+ }
+
+ struct atan_root
+ {
+ atan_root(RR const& target) : t(target){}
+
+ std::tr1::tuple<RR, RR, RR> operator()(RR const& p)
+ {
+ RR c = cos(p);
+ RR ta = tan(p);
+ RR f0 = ta - t;
+ RR f1 = 1 / (c * c);
+ RR f2 = 2 * ta / (c * c);
+ return std::tr1::make_tuple(f0, f1, f2);
+ }
+ private:
+ RR t;
+ };
+
+ inline RR atan(RR z)
+ {
+ double r;
+ conv(r, z.value());
+ return boost::math::tools::halley_iterate(
+ atan_root(z),
+ RR(std::atan(r)),
+ -boost::math::constants::pi<RR>()/2,
+ boost::math::constants::pi<RR>()/2,
+ NTL::RR::precision());
+ }
+
+ inline RR sinh(RR z)
+ {
+ return (expm1(z.value()) - expm1(-z.value())) / 2;
+ }
+
+ inline RR cosh(RR z)
+ {
+ return (exp(z) + exp(-z)) / 2;
+ }
+
+ inline RR tanh(RR z)
+ {
+ return sinh(z) / cosh(z);
+ }
+
+ inline RR fmod(RR x, RR y)
+ {
+ // This is a really crummy version of fmod, we rely on lots
+ // of digits to get us out of trouble...
+ RR factor = floor(x/y);
+ return x - factor * y;
+ }
+
+} // namespace ntl
+
+} // namespace math
+} // namespace boost
+
+#endif // BOOST_MATH_REAL_CONCEPT_HPP
+
+

Deleted: sandbox/math_toolkit/boost/math/tools/ntl.hpp
==============================================================================
--- sandbox/math_toolkit/boost/math/tools/ntl.hpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
+++ (empty file)
@@ -1,378 +0,0 @@
-// (C) Copyright John Maddock 2006.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_MATH_TOOLS_NTL_HPP
-#define BOOST_MATH_TOOLS_NTL_HPP
-
-
-#include <NTL/RR.h>
-#include <boost/math/tools/real_cast.hpp>
-#include <boost/math/tools/precision.hpp>
-#include <boost/math/constants/constants.hpp>
-#include <boost/math/policies/policy.hpp>
-
-namespace NTL
-{
-
- inline quad_float pow(quad_float a, quad_float b)
- {
- return to_quad_float(pow(RR(a), RR(b)));
- }
-
- inline quad_float pow(quad_float a, long b)
- {
- return to_quad_float(pow(RR(a), RR(b)));
- }
-
- inline RR pow(const RR& r, long l)
- {
- return power(r, l);
- }
- inline RR tan(const RR& a)
- {
- return sin(a)/cos(a);
- }
- inline RR frexp(RR r, int* exp)
- {
- *exp = r.e;
- r.e = 0;
- while(r >= 1)
- {
- *exp += 1;
- r.e -= 1;
- }
- while(r < 0.5)
- {
- *exp -= 1;
- r.e += 1;
- }
- BOOST_ASSERT(r < 1);
- BOOST_ASSERT(r >= 0.5);
- return r;
- }
- inline RR ldexp(RR r, int exp)
- {
- r.e += exp;
- return r;
- }
-
-} // namespace NTL
-
-namespace boost{ namespace math{
-
-namespace tools{
-
-template<>
-inline int digits<NTL::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(NTL::RR))
-{
- return NTL::RR::precision();
-}
-
-template <>
-inline float real_cast<float, NTL::RR>(NTL::RR t)
-{
- double r;
- conv(r, t);
- return static_cast<float>(r);
-}
-template <>
-inline double real_cast<double, NTL::RR>(NTL::RR t)
-{
- double r;
- conv(r, t);
- return r;
-}
-template <>
-inline long double real_cast<long double, NTL::RR>(NTL::RR t)
-{
- long double result(0), last_result(0);
- double term;
- do
- {
- term = real_cast<double>(t);
- last_result = result;
- result += term;
- t -= term;
- }while(result != last_result);
- return result;
-}
-template <>
-inline NTL::RR real_cast<NTL::RR, NTL::RR>(NTL::RR t)
-{
- return t;
-}
-template <>
-inline unsigned real_cast<unsigned, NTL::RR>(NTL::RR t)
-{
- return static_cast<unsigned>(real_cast<long double>(t));;
-}
-template <>
-inline int real_cast<int, NTL::RR>(NTL::RR t)
-{
- return static_cast<int>(real_cast<long double>(t));;
-}
-
-template <>
-inline NTL::RR max_value<NTL::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(NTL::RR))
-{
- static bool has_init = false;
- static NTL::RR val;
- if(!has_init)
- {
- val = 1;
- val.e = NTL_OVFBND-20;
- has_init = true;
- }
- return val;
-}
-
-template <>
-inline NTL::RR min_value<NTL::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(NTL::RR))
-{
- static bool has_init = false;
- static NTL::RR val;
- if(!has_init)
- {
- val = 1;
- val.e = -NTL_OVFBND+20;
- has_init = true;
- }
- return val;
-}
-
-template <>
-inline NTL::RR log_max_value<NTL::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(NTL::RR))
-{
- static bool has_init = false;
- static NTL::RR val;
- if(!has_init)
- {
- val = 1;
- val.e = NTL_OVFBND-20;
- val = log(val);
- has_init = true;
- }
- return val;
-}
-
-template <>
-inline NTL::RR log_min_value<NTL::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(NTL::RR))
-{
- static bool has_init = false;
- static NTL::RR val;
- if(!has_init)
- {
- val = 1;
- val.e = -NTL_OVFBND+20;
- val = log(val);
- has_init = true;
- }
- return val;
-}
-
-template <>
-inline NTL::RR epsilon<NTL::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(NTL::RR))
-{
- return ldexp(NTL::RR(1), 1-boost::math::policies::digits<NTL::RR, boost::math::policies::policy<> >());
-}
-
-} // namespace tools
-
-//
-// The number of digits precision in RR can vary with each call
-// so we need to recalculate these with each call:
-//
-namespace constants{
-
- template<> inline NTL::RR pi<NTL::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(NTL::RR))
- {
- NTL::RR result;
- ComputePi(result);
- return result;
- }
- template<> inline NTL::RR e<NTL::RR>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(NTL::RR))
- {
- NTL::RR result = 1;
- return exp(result);
- }
-
-} // namespace constants
-
-namespace tools
-{
-
-template <>
-inline float real_cast<float, NTL::quad_float>(NTL::quad_float t)
-{
- return to_float(t);
-}
-template <>
-inline double real_cast<double, NTL::quad_float>(NTL::quad_float t)
-{
- return to_double(t);
-}
-template <>
-inline long double real_cast<long double, NTL::quad_float>(NTL::quad_float x)
-{
- long double result = x.hi;
- result += x.lo;
- return result;
-}
-template <>
-inline NTL::quad_float real_cast<NTL::quad_float, NTL::quad_float>(NTL::quad_float t)
-{
- return t;
-}
-
-template <>
-inline NTL::quad_float real_cast<NTL::quad_float, NTL::RR>(NTL::RR t)
-{
- return to_quad_float(t);
-}
-
-template <>
-inline NTL::quad_float max_value<NTL::quad_float>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(NTL::quad_float))
-{
- return max_value<double>();
-}
-
-template <>
-inline NTL::quad_float min_value<NTL::quad_float>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(NTL::quad_float))
-{
- return min_value<double>();
-}
-
-template <>
-inline NTL::quad_float log_max_value<NTL::quad_float>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(NTL::quad_float))
-{
- return log_max_value<double>();
-}
-
-template <>
-inline NTL::quad_float log_min_value<NTL::quad_float>(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(NTL::quad_float))
-{
- return log_min_value<double>();
-}
-
-} // namespace tools
-} // namespace math
-} // namespaceboost
-
-//
-// The following *must* all occur after the definitions above
-// since we rely on them being already defined:
-//
-#include <boost/math/tools/roots.hpp>
-
-namespace NTL{
-
- //
- // Inverse trig functions:
- //
- struct asin_root
- {
- asin_root(NTL::RR const& target) : t(target){}
-
- std::tr1::tuple<NTL::RR, NTL::RR, NTL::RR> operator()(NTL::RR const& p)
- {
- NTL::RR f0 = sin(p);
- NTL::RR f1 = cos(p);
- NTL::RR f2 = -f0;
- f0 -= t;
- return std::tr1::make_tuple(f0, f1, f2);
- }
- private:
- NTL::RR t;
- };
-
- inline NTL::RR asin(NTL::RR z)
- {
- return boost::math::tools::halley_iterate(
- asin_root(z),
- NTL::RR(std::asin(boost::math::tools::real_cast<double>(z))),
- NTL::RR(-boost::math::constants::pi<NTL::RR>()/2),
- NTL::RR(boost::math::constants::pi<NTL::RR>()/2),
- boost::math::policies::digits<NTL::RR, boost::math::policies::policy<> >());
- }
-
- struct acos_root
- {
- acos_root(NTL::RR const& target) : t(target){}
-
- std::tr1::tuple<NTL::RR, NTL::RR, NTL::RR> operator()(NTL::RR const& p)
- {
- NTL::RR f0 = cos(p);
- NTL::RR f1 = -sin(p);
- NTL::RR f2 = -f0;
- f0 -= t;
- return std::tr1::make_tuple(f0, f1, f2);
- }
- private:
- NTL::RR t;
- };
-
- inline NTL::RR acos(NTL::RR z)
- {
- return boost::math::tools::halley_iterate(
- acos_root(z),
- NTL::RR(std::acos(boost::math::tools::real_cast<double>(z))),
- NTL::RR(-boost::math::constants::pi<NTL::RR>()/2),
- NTL::RR(boost::math::constants::pi<NTL::RR>()/2),
- boost::math::policies::digits<NTL::RR, boost::math::policies::policy<> >());
- }
-
- struct atan_root
- {
- atan_root(NTL::RR const& target) : t(target){}
-
- std::tr1::tuple<NTL::RR, NTL::RR, NTL::RR> operator()(NTL::RR const& p)
- {
- NTL::RR c = cos(p);
- NTL::RR ta = tan(p);
- NTL::RR f0 = ta - t;
- NTL::RR f1 = 1 / (c * c);
- NTL::RR f2 = 2 * ta / (c * c);
- return std::tr1::make_tuple(f0, f1, f2);
- }
- private:
- NTL::RR t;
- };
-
- inline NTL::RR atan(NTL::RR z)
- {
- return boost::math::tools::halley_iterate(
- atan_root(z),
- NTL::RR(std::atan(boost::math::tools::real_cast<double>(z))),
- -boost::math::constants::pi<NTL::RR>()/2,
- boost::math::constants::pi<NTL::RR>()/2,
- boost::math::policies::digits<NTL::RR, boost::math::policies::policy<> >());
- }
-
- inline NTL::RR sinh(NTL::RR z)
- {
- return (expm1(z) - expm1(-z)) / 2;
- }
-
- inline NTL::RR cosh(NTL::RR z)
- {
- return (exp(z) + exp(-z)) / 2;
- }
-
- inline NTL::RR fmod(NTL::RR x, NTL::RR y)
- {
- // This is a really crummy version of fmod, we rely on lots
- // of digits to get us out of trouble...
- NTL::RR factor = floor(x/y);
- return x - factor * y;
- }
-
-} // namespace NTL
-
-
-#endif // BOOST_MATH_TOOLS_NTL_HPP
-
-
-
-

Modified: sandbox/math_toolkit/libs/math/doc/concepts.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/concepts.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/concepts.qbk 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -2,29 +2,19 @@
 
 The special functions and tools in this library can be used with
 [@http://shoup.net/ntl/doc/RR.txt NTL::RR (an arbitrary precision number type)],
-and to a lesser extent with [@http://shoup.net/ntl/doc/quad_float.txt
-NTL::quad_float] (128-bit, using 106 significand bits).
-[@http://shoup.net/ntl/ Refer to NTL: A Library for doing Number Theory by
+via the bindings in [@../../../../boost/math/bindings/rr.hpp boost/math/bindings/rr.hpp].
+[@http://shoup.net/ntl/ See also NTL: A Library for doing Number Theory by
 Victor Shoup]
 
-In order to do so you will need to apply the following patch to
-NTL: [@../tools/ntl.diff libs/math/tools/ntl.diff].
-This patch adds trivial converting constructors to NTL::RR and NTL::quad_float,
-and forces conversions to RR to proceed via `long double` rather than `double`.
-The latter change is essential to accurately measure relative errors between
-high precision calculations (using NTL::RR) and fixed precision calculations
-(using `long double`). These occur if, for example, you are generating additional
-__lanczos's or rational approximations suitable for use with `long double`.
-
-You will also need to include NTL via the header `<boost/math/tools/ntl.hpp>`
-and include that header /before/ you include any of the special function headers.
-The rationale for this is that the header `<boost/math/tools/ntl.hpp>` includes some traits classes
-and boilerplate code (mostly runtime substitutes for numeric_limits) that are
-required by the special functions. Unfortunately, some of the stricter compilers
-require these definitions to be seen before the templates that will use them are
-parsed.
+Unfortunately `NTL::RR` doesn't quite satisfy our conceptual requirements,
+so there is a very thin wrapper class `boost::math::ntl::RR` defined in
+[@../../../../boost/math/bindings/rr.hpp boost/math/bindings/rr.hpp] that you
+should use in place of `NTL::RR`. The class is intended to be a drop-in
+replacement for the "real" NTL::RR that adds some syntactic sugar to keep
+this library happy, plus some of the standard library functions not implemented
+in NTL.
 
-Finally there is a high precision __lanczos suitable for use with NTL::RR,
+Finally there is a high precision __lanczos suitable for use with `boost::math::ntl::RR`,
 used at 1000-bit precision in
 [@../tools/ntl_rr_lanczos.hpp libs/math/tools/ntl_rr_lanczos.hpp].
 The approximation has a theoretical precision of > 90 decimal digits,
@@ -41,8 +31,9 @@
 any type /RealType/ that meets the conceptual requirements given below. All
 the built in floating point types will meet these requirements.
 User defined types that meet the requirements can also be used. For example,
-with [link math_toolkit.using_udt.use_ntl minor modifications] two of the types
-provided with [@http://shoup.net/ntl/ NTL (RR and quad_float)] can be used.
+with [link math_toolkit.using_udt.use_ntl a thin wrapper class] one of the types
+provided with [@http://shoup.net/ntl/ NTL (RR)] can be used. Submissions
+of binding to other extended precision types would also be most welcome!
 
 The guiding principal behind these requirements, is that a /RealType/
 behaves just like a built in floating point type.

Modified: sandbox/math_toolkit/libs/math/minimax/f.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/minimax/f.cpp (original)
+++ sandbox/math_toolkit/libs/math/minimax/f.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -6,7 +6,7 @@
 #define L22
 #include "../tools/ntl_rr_lanczos.hpp"
 #include "../tools/ntl_rr_digamma.hpp"
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/math/tools/polynomial.hpp>
 #include <boost/math/special_functions/log1p.hpp>
 #include <boost/math/special_functions/expm1.hpp>
@@ -18,9 +18,9 @@
 #include <cmath>
 
 
-NTL::RR f(const NTL::RR& x, int variant)
+boost::math::ntl::RR f(const boost::math::ntl::RR& x, int variant)
 {
- static const NTL::RR tiny = boost::math::tools::min_value<NTL::RR>() * 64;
+ static const boost::math::ntl::RR tiny = boost::math::tools::min_value<boost::math::ntl::RR>() * 64;
    switch(variant)
    {
    case 0:
@@ -29,12 +29,12 @@
       return boost::math::erf(x);
    case 2:
       {
- NTL::RR x_ = x == 0 ? 1e-80 : x;
+ boost::math::ntl::RR x_ = x == 0 ? 1e-80 : x;
       return boost::math::erf(x_) / x_;
       }
    case 3:
       {
- NTL::RR y(x);
+ boost::math::ntl::RR y(x);
          if(y == 0)
             y += tiny;
          return boost::math::lgamma(y+2) / y - 0.5;
@@ -50,7 +50,7 @@
       //
       if(x == 0)
       {
- return boost::lexical_cast<NTL::RR>("0.42278433509846713939348790991759756895784066406008") / 3;
+ return boost::lexical_cast<boost::math::ntl::RR>("0.42278433509846713939348790991759756895784066406008") / 3;
       }
       return boost::math::lgamma(x+2) / (x * (x+3));
    case 5:
@@ -62,8 +62,8 @@
          //
          // works well over [1, 1.5] but not near 2 :-(
          //
- NTL::RR r1 = boost::lexical_cast<NTL::RR>("0.57721566490153286060651209008240243104215933593992");
- NTL::RR r2 = boost::lexical_cast<NTL::RR>("0.42278433509846713939348790991759756895784066406008");
+ boost::math::ntl::RR r1 = boost::lexical_cast<boost::math::ntl::RR>("0.57721566490153286060651209008240243104215933593992");
+ boost::math::ntl::RR r2 = boost::lexical_cast<boost::math::ntl::RR>("0.42278433509846713939348790991759756895784066406008");
          if(x == 0)
          {
             return r1;
@@ -83,8 +83,8 @@
          //
          // works well over [1.5, 2] but not near 1 :-(
          //
- NTL::RR r1 = boost::lexical_cast<NTL::RR>("0.57721566490153286060651209008240243104215933593992");
- NTL::RR r2 = boost::lexical_cast<NTL::RR>("0.42278433509846713939348790991759756895784066406008");
+ boost::math::ntl::RR r1 = boost::lexical_cast<boost::math::ntl::RR>("0.57721566490153286060651209008240243104215933593992");
+ boost::math::ntl::RR r2 = boost::lexical_cast<boost::math::ntl::RR>("0.42278433509846713939348790991759756895784066406008");
          if(x == 0)
          {
             return r2;
@@ -100,9 +100,9 @@
          //
          // erf_inv in range [0, 0.5]
          //
- NTL::RR y = x;
+ boost::math::ntl::RR y = x;
          if(y == 0)
- y = boost::math::tools::epsilon<NTL::RR>() / 64;
+ y = boost::math::tools::epsilon<boost::math::ntl::RR>() / 64;
          return boost::math::erf_inv(y) / (y * (y+10));
       }
    case 8:
@@ -112,17 +112,17 @@
          // Use an y-offset of 0.25, and range [0, 0.25]
          // abs error, auto y-offset.
          //
- NTL::RR y = x;
+ boost::math::ntl::RR y = x;
          if(y == 0)
- y = boost::lexical_cast<NTL::RR>("1e-5000");
+ y = boost::lexical_cast<boost::math::ntl::RR>("1e-5000");
          return sqrt(-2 * log(y)) / boost::math::erfc_inv(y);
       }
    case 9:
       {
- NTL::RR x2 = x;
+ boost::math::ntl::RR x2 = x;
          if(x2 == 0)
- x2 = boost::lexical_cast<NTL::RR>("1e-5000");
- NTL::RR y = exp(-x2*x2); // sqrt(-log(x2)) - 5;
+ x2 = boost::lexical_cast<boost::math::ntl::RR>("1e-5000");
+ boost::math::ntl::RR y = exp(-x2*x2); // sqrt(-log(x2)) - 5;
          return boost::math::erfc_inv(y) / x2;
       }
    case 10:
@@ -131,9 +131,9 @@
          // Digamma over the interval [1,2], set x-offset to 1
          // and optimise for absolute error over [0,1].
          //
- int current_precision = NTL::RR::precision();
+ int current_precision = boost::math::ntl::RR::precision();
          if(current_precision < 1000)
- NTL::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetPrecision(1000);
          //
          // This value for the root of digamma is calculated using our
          // differentiated lanczos approximation. It agrees with Cody
@@ -141,18 +141,18 @@
          // TOMS ALGORITHM 708 (Didonato and Morris).
          // and Math. Comp. 27, 123-127 (1973) by Cody, Strecok and Thacher.
          //
- //NTL::RR root = boost::lexical_cast<NTL::RR>("1.4616321449683623412626595423257213234331845807102825466429633351908372838889871");
+ //boost::math::ntl::RR root = boost::lexical_cast<boost::math::ntl::RR>("1.4616321449683623412626595423257213234331845807102825466429633351908372838889871");
          //
          // Actually better to calculate the root on the fly, it appears to be more
          // accurate: convergence is easier with the 1000-bit value, the approximation
          // produced agrees with functions.mathworld.com values to 35 digits even quite
          // near the root.
          //
- static boost::math::tools::eps_tolerance<NTL::RR> tol(1000);
+ static boost::math::tools::eps_tolerance<boost::math::ntl::RR> tol(1000);
          static boost::uintmax_t max_iter = 1000;
- static const NTL::RR root = boost::math::tools::bracket_and_solve_root(&boost::math::digamma, NTL::RR(1.4), NTL::RR(1.5), true, tol, max_iter).first;
+ static const boost::math::ntl::RR root = boost::math::tools::bracket_and_solve_root(&boost::math::digamma, boost::math::ntl::RR(1.4), boost::math::ntl::RR(1.5), true, tol, max_iter).first;
 
- NTL::RR x2 = x;
+ boost::math::ntl::RR x2 = x;
          double lim = 1e-65;
          if(fabs(x2 - root) < lim)
          {
@@ -162,29 +162,29 @@
             // That gets compounded again when Remez calculates the error
             // function. This cludge seems to stop the worst of the problems:
             //
- static const NTL::RR a = boost::math::digamma(root - lim) / -lim;
- static const NTL::RR b = boost::math::digamma(root + lim) / lim;
- NTL::RR fract = (x2 - root + lim) / (2*lim);
- NTL::RR r = (1-fract) * a + fract * b;
+ static const boost::math::ntl::RR a = boost::math::digamma(root - lim) / -lim;
+ static const boost::math::ntl::RR b = boost::math::digamma(root + lim) / lim;
+ boost::math::ntl::RR fract = (x2 - root + lim) / (2*lim);
+ boost::math::ntl::RR r = (1-fract) * a + fract * b;
             std::cout << "In root area: " << r;
             return r;
          }
- NTL::RR result = boost::math::digamma(x2) / (x2 - root);
+ boost::math::ntl::RR result = boost::math::digamma(x2) / (x2 - root);
          if(current_precision < 1000)
- NTL::RR::SetPrecision(current_precision);
+ boost::math::ntl::RR::SetPrecision(current_precision);
          return result;
       }
    case 11:
       // expm1:
       if(x == 0)
       {
- static NTL::RR lim = 1e-80;
- static NTL::RR a = expm1(-lim);
- static NTL::RR b = expm1(lim);
- static NTL::RR l = (b-a) / (2 * lim);
+ static boost::math::ntl::RR lim = 1e-80;
+ static boost::math::ntl::RR a = boost::math::expm1(-lim);
+ static boost::math::ntl::RR b = boost::math::expm1(lim);
+ static boost::math::ntl::RR l = (b-a) / (2 * lim);
          return l;
       }
- return expm1(x) / x;
+ return boost::math::expm1(x) / x;
    case 12:
       // demo, and test case:
       return exp(x);
@@ -192,31 +192,31 @@
       // K(k):
       {
          // x = k^2
- NTL::RR k2 = x;
- if(k2 > NTL::RR(1) - 1e-40)
- k2 = NTL::RR(1) - 1e-40;
+ boost::math::ntl::RR k2 = x;
+ if(k2 > boost::math::ntl::RR(1) - 1e-40)
+ k2 = boost::math::ntl::RR(1) - 1e-40;
          /*if(k < 1e-40)
             k = 1e-40;*/
- NTL::RR p2 = boost::math::constants::pi<NTL::RR>() / 2;
+ boost::math::ntl::RR p2 = boost::math::constants::pi<boost::math::ntl::RR>() / 2;
          return (boost::math::ellint_1(sqrt(k2))) / (p2 - boost::math::log1p(-k2));
       }
    case 14:
       // K(k)
       {
          // x = 1 - k^2
- NTL::RR mp = x;
+ boost::math::ntl::RR mp = x;
          if(mp < 1e-20)
             mp = 1e-20;
- NTL::RR k = sqrt(1 - mp);
- static const NTL::RR l4 = log(NTL::RR(4));
- NTL::RR p2 = boost::math::constants::pi<NTL::RR>() / 2;
+ boost::math::ntl::RR k = sqrt(1 - mp);
+ static const boost::math::ntl::RR l4 = log(boost::math::ntl::RR(4));
+ boost::math::ntl::RR p2 = boost::math::constants::pi<boost::math::ntl::RR>() / 2;
          return boost::math::ellint_1(k) / (l4 - log(mp));
       }
    case 15:
       // E(k)
       {
          // x = 1-k^2
- NTL::RR z = 1 - x * log(x);
+ boost::math::ntl::RR z = 1 - x * log(x);
          return boost::math::ellint_2(sqrt(1-x)) / z;
       }
    }
@@ -224,10 +224,10 @@
 }
 
 void show_extra(
- const boost::math::tools::polynomial<NTL::RR>& n,
- const boost::math::tools::polynomial<NTL::RR>& d,
- const NTL::RR& x_offset,
- const NTL::RR& y_offset,
+ const boost::math::tools::polynomial<boost::math::ntl::RR>& n,
+ const boost::math::tools::polynomial<boost::math::ntl::RR>& d,
+ const boost::math::ntl::RR& x_offset,
+ const boost::math::ntl::RR& y_offset,
    int variant)
 {
    switch(variant)

Modified: sandbox/math_toolkit/libs/math/minimax/main.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/minimax/main.cpp (original)
+++ sandbox/math_toolkit/libs/math/minimax/main.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -6,7 +6,7 @@
 #define BOOST_UBLAS_TYPE_CHECK_EPSILON (type_traits<real_type>::type_sqrt (boost::math::tools::epsilon <real_type>()))
 #define BOOST_UBLAS_TYPE_CHECK_MIN (type_traits<real_type>::type_sqrt ( boost::math::tools::min_value<real_type>()))
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/math/tools/remez.hpp>
 #include <boost/math/tools/test.hpp>
 #include <boost/spirit/core.hpp>
@@ -17,17 +17,17 @@
 #include <string>
 #include <boost/test/included/test_exec_monitor.hpp> // for test_main
 
-extern NTL::RR f(const NTL::RR& x, int variant);
+extern boost::math::ntl::RR f(const boost::math::ntl::RR& x, int variant);
 extern void show_extra(
- const boost::math::tools::polynomial<NTL::RR>& n,
- const boost::math::tools::polynomial<NTL::RR>& d,
- const NTL::RR& x_offset,
- const NTL::RR& y_offset,
+ const boost::math::tools::polynomial<boost::math::ntl::RR>& n,
+ const boost::math::tools::polynomial<boost::math::ntl::RR>& d,
+ const boost::math::ntl::RR& x_offset,
+ const boost::math::ntl::RR& y_offset,
    int variant);
 
 using namespace boost::spirit;
 
-NTL::RR a(0), b(1); // range to optimise over
+boost::math::ntl::RR a(0), b(1); // range to optimise over
 bool rel_error(true);
 bool pin(false);
 int orderN(3);
@@ -38,12 +38,12 @@
 int variant(0);
 int skew(0);
 int brake(50);
-NTL::RR x_offset(0), y_offset(0);
+boost::math::ntl::RR x_offset(0), y_offset(0);
 bool auto_offset_y;
 
-boost::shared_ptr<boost::math::tools::remez_minimax<NTL::RR> > p_remez;
+boost::shared_ptr<boost::math::tools::remez_minimax<boost::math::ntl::RR> > p_remez;
 
-NTL::RR the_function(const NTL::RR& val)
+boost::math::ntl::RR the_function(const boost::math::ntl::RR& val)
 {
    return f(val + x_offset, variant) + y_offset;
 }
@@ -59,7 +59,7 @@
          //
          if(auto_offset_y)
          {
- NTL::RR fa, fb, fm;
+ boost::math::ntl::RR fa, fb, fm;
             fa = f(a + x_offset, variant);
             fb = f(b + x_offset, variant);
             fm = f((a+b)/2 + x_offset, variant);
@@ -70,12 +70,12 @@
          //
          // Truncate offsets to float precision:
          //
- x_offset = NTL::RoundToPrecision(x_offset, 20);
- y_offset = NTL::RoundToPrecision(y_offset, 20);
+ x_offset = NTL::RoundToPrecision(x_offset.value(), 20);
+ y_offset = NTL::RoundToPrecision(y_offset.value(), 20);
          //
          // Construct new Remez state machine:
          //
- p_remez.reset(new boost::math::tools::remez_minimax<NTL::RR>(
+ p_remez.reset(new boost::math::tools::remez_minimax<boost::math::ntl::RR>(
             &the_function,
             orderN, orderD,
             a, b,
@@ -93,7 +93,7 @@
       {
          std::cout << "Stepping..." << std::endl;
          p_remez->set_brake(brake);
- NTL::RR r = p_remez->iterate();
+ boost::math::ntl::RR r = p_remez->iterate();
          NTL::RR::SetOutputPrecision(3);
          std::cout
             << "Maximum Deviation Found: " << std::setprecision(3) << std::scientific << boost::math::tools::real_cast<double>(p_remez->max_error()) << std::endl
@@ -117,12 +117,12 @@
    NTL::RR::SetPrecision(working_precision);
    if(started)
    {
- boost::math::tools::polynomial<NTL::RR> n = p_remez->numerator();
- boost::math::tools::polynomial<NTL::RR> d = p_remez->denominator();
+ boost::math::tools::polynomial<boost::math::ntl::RR> n = p_remez->numerator();
+ boost::math::tools::polynomial<boost::math::ntl::RR> d = p_remez->denominator();
       int prec = 2 + (target_precision * 3010LL)/10000;
       std::cout << std::scientific << std::setprecision(prec);
       NTL::RR::SetOutputPrecision(prec);
- boost::numeric::ublas::vector<NTL::RR> v = p_remez->zero_points();
+ boost::numeric::ublas::vector<boost::math::ntl::RR> v = p_remez->zero_points();
       
       std::cout << " Zeros = {\n";
       for(unsigned i = 0; i < v.size(); ++i)
@@ -167,8 +167,8 @@
 void do_graph(unsigned points)
 {
    NTL::RR::SetPrecision(working_precision);
- NTL::RR step = (b - a) / (points - 1);
- NTL::RR x = a;
+ boost::math::ntl::RR step = (b - a) / (points - 1);
+ boost::math::ntl::RR x = a;
    while(points > 1)
    {
       NTL::RR::SetOutputPrecision(10);
@@ -189,7 +189,7 @@
 template <class T>
 void do_test(T, const char* name)
 {
- NTL::RR::SetPrecision(working_precision);
+ boost::math::ntl::RR::SetPrecision(working_precision);
    if(started)
    {
       //
@@ -205,11 +205,11 @@
       // (in theory) the largest deviation should occur. For good
       // measure we'll test at the zeros as well:
       //
- boost::numeric::ublas::vector<NTL::RR>
+ boost::numeric::ublas::vector<boost::math::ntl::RR>
          zeros(p_remez->zero_points()),
          cheb(p_remez->chebyshev_points());
 
- NTL::RR max_error(0);
+ boost::math::ntl::RR max_error(0);
 
       //
       // Do the tests at the zeros:
@@ -218,10 +218,10 @@
       std::cout << "Absissa Error\n";
       for(unsigned i = 0; i < zeros.size(); ++i)
       {
- NTL::RR true_result = the_function(zeros[i]);
+ boost::math::ntl::RR true_result = the_function(zeros[i]);
          T absissa = boost::math::tools::real_cast<T>(zeros[i]);
- NTL::RR test_result = n.evaluate(absissa) / d.evaluate(absissa);
- NTL::RR err;
+ boost::math::ntl::RR test_result = n.evaluate(absissa) / d.evaluate(absissa);
+ boost::math::ntl::RR err;
          if(rel_error)
          {
             err = boost::math::tools::relative_error(test_result, true_result);
@@ -240,10 +240,10 @@
       //
       for(unsigned i = 0; i < cheb.size(); ++i)
       {
- NTL::RR true_result = the_function(cheb[i]);
+ boost::math::ntl::RR true_result = the_function(cheb[i]);
          T absissa = boost::math::tools::real_cast<T>(cheb[i]);
- NTL::RR test_result = n.evaluate(absissa) / d.evaluate(absissa);
- NTL::RR err;
+ boost::math::ntl::RR test_result = n.evaluate(absissa) / d.evaluate(absissa);
+ boost::math::ntl::RR err;
          if(rel_error)
          {
             err = boost::math::tools::relative_error(test_result, true_result);
@@ -290,7 +290,7 @@
 template <class T>
 void do_test_n(T, const char* name, unsigned count)
 {
- NTL::RR::SetPrecision(working_precision);
+ boost::math::ntl::RR::SetPrecision(working_precision);
    if(started)
    {
       //
@@ -302,20 +302,20 @@
       n = p_remez->numerator();
       d = p_remez->denominator();
 
- NTL::RR max_error(0);
- NTL::RR step = (b - a) / count;
+ boost::math::ntl::RR max_error(0);
+ boost::math::ntl::RR step = (b - a) / count;
 
       //
       // Do the tests at the zeros:
       //
       std::cout << "Starting tests at " << name << " precision...\n";
       std::cout << "Absissa Error\n";
- for(NTL::RR x = a; x <= b; x += step)
+ for(boost::math::ntl::RR x = a; x <= b; x += step)
       {
- NTL::RR true_result = the_function(x);
+ boost::math::ntl::RR true_result = the_function(x);
          T absissa = boost::math::tools::real_cast<T>(x);
- NTL::RR test_result = n.evaluate(absissa) / d.evaluate(absissa);
- NTL::RR err;
+ boost::math::ntl::RR test_result = n.evaluate(absissa) / d.evaluate(absissa);
+ boost::math::ntl::RR err;
          if(rel_error)
          {
             err = boost::math::tools::relative_error(test_result, true_result);
@@ -339,7 +339,7 @@
 
 void test_n(unsigned n)
 {
- do_test_n(NTL::RR(), "NTL::RR", n);
+ do_test_n(boost::math::ntl::RR(), "boost::math::ntl::RR", n);
 }
 
 void test_float_n(unsigned n)

Modified: sandbox/math_toolkit/libs/math/tools/bessel_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/bessel_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/bessel_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -5,7 +5,7 @@
 //
 // Computes test data for the various bessel functions using
 // archived - deliberately naive - version of the code.
-// We'll rely on the high precision of NTL::RR to get us out of
+// We'll rely on the high precision of boost::math::ntl::RR to get us out of
 // trouble and not worry about how long the calculations take.
 // This provides a reasonably independent set of test data to
 // compare against newly added asymptotic expansions etc.
@@ -13,7 +13,7 @@
 #include <fstream>
 
 #include <boost/math/tools/test_data.hpp>
-#include <libs/math_functions/tools/ntl_rr_lanczos.hpp>
+#include "ntl_rr_lanczos.hpp"
 
 #include <boost/math/special_functions/bessel.hpp>
 
@@ -49,14 +49,14 @@
 
     if (x < 0)
     {
- *J = *Y = tools::domain_error<T>(BOOST_CURRENT_FUNCTION,
- "Real argument x=%1% must be non-negative, complex number result not supported", x);
+ *J = *Y = policies::raise_domain_error<T>("",
+ "Real argument x=%1% must be non-negative, complex number result not supported", x, policies::policy<>());
         return 1;
     }
     if (x == 0)
     {
- *J = *Y = tools::overflow_error<T>(
- BOOST_CURRENT_FUNCTION, 0);
+ *J = *Y = policies::raise_overflow_error<T>(
+ "", 0, policies::policy<>());
        return 1;
     }
 
@@ -64,7 +64,7 @@
     W = T(2) / (x * pi<T>()); // Wronskian
     if (x <= 2) // x in (0, 2]
     {
- if(temme_jy(u, x, &Yu, &Yu1)) // Temme series
+ if(temme_jy(u, x, &Yu, &Yu1, policies::policy<>())) // Temme series
         {
            // domain error:
            *J = *Y = Yu;
@@ -80,13 +80,13 @@
         }
         Yv = prev;
         Yv1 = current;
- CF1_jy(v, x, &fv, &s); // continued fraction CF1
+ CF1_jy(v, x, &fv, &s, policies::policy<>()); // continued fraction CF1
         Jv = W / (Yv * fv - Yv1); // Wronskian relation
     }
     else // x in (2, \infty)
     {
         // Get Y(u, x):
- CF1_jy(v, x, &fv, &s);
+ CF1_jy(v, x, &fv, &s, policies::policy<>());
         // tiny initial value to prevent overflow
         T init = sqrt(tools::min_value<T>());
         prev = fv * s * init;
@@ -100,7 +100,7 @@
         T ratio = (s * init) / current; // scaling ratio
         // can also call CF1() to get fu, not much difference in precision
         fu = prev / current;
- CF2_jy(u, x, &p, &q); // continued fraction CF2
+ CF2_jy(u, x, &p, &q, policies::policy<>()); // continued fraction CF2
         T t = u / x - fu; // t = J'/J
         gamma = (p - t) / q;
         Ju = sign(current) * sqrt(W / (q + gamma * (p - t)));
@@ -168,16 +168,16 @@
          return r;
       }
       else
- return tools::domain_error<T>(
- BOOST_CURRENT_FUNCTION,
- "Got x = %1%, but we need x >= 0", x);
+ return policies::raise_domain_error<T>(
+ "",
+ "Got x = %1%, but we need x >= 0", x, policies::policy<>());
    }
    if(x == 0)
    {
       return (v == 0) ? 1 : 0;
    }
    T I, K;
- boost::math::detail::bessel_ik(v, x, &I, &K);
+ boost::math::detail::bessel_ik(v, x, &I, &K, 0xffff, policies::policy<>());
 
    std::cout << progress++ << ": I(" << v << ", " << x << ") = " << I << std::endl;
 
@@ -193,19 +193,19 @@
    using namespace std;
    if(x < 0)
    {
- return tools::domain_error<T>(
- BOOST_CURRENT_FUNCTION,
- "Got x = %1%, but we need x > 0", x);
+ return policies::raise_domain_error<T>(
+ "",
+ "Got x = %1%, but we need x > 0", x, policies::policy<>());
    }
    if(x == 0)
    {
- return (v == 0) ? tools::overflow_error<T>(BOOST_CURRENT_FUNCTION, 0)
- : tools::domain_error<T>(
- BOOST_CURRENT_FUNCTION,
- "Got x = %1%, but we need x > 0", x);
+ return (v == 0) ? policies::raise_overflow_error<T>("", 0, policies::policy<>())
+ : policies::raise_domain_error<T>(
+ "",
+ "Got x = %1%, but we need x > 0", x, policies::policy<>());
    }
    T I, K;
- bessel_ik(v, x, &I, &K);
+ bessel_ik(v, x, &I, &K, 0xFFFF, policies::policy<>());
 
    std::cout << progress++ << ": K(" << v << ", " << x << ") = " << K << std::endl;
 
@@ -219,7 +219,7 @@
 T cyl_neumann_bare(T v, T x)
 {
    T j, y;
- bessel_jy(v, x, &j, &y);
+ bessel_jy(v, x, &j, &y, 0xFFFF, policies::policy<>());
 
    std::cout << progress++ << ": Y(" << v << ", " << x << ") = " << y << std::endl;
 
@@ -267,11 +267,11 @@
    std::cout << sph_bessel_j_bare(0., 0.1185395751953125e4) << std::endl;
    std::cout << sph_bessel_j_bare(22., 0.6540834903717041015625) << std::endl;
 
- parameter_info<NTL::RR> arg1, arg2;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1, arg2;
+ test_data<boost::math::ntl::RR> data;
 
- NTL::RR::SetPrecision(1000);
- NTL::RR::SetOutputPrecision(40);
+ boost::math::ntl::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(40);
 
    int functype = 0;
    std::string letter = "J";
@@ -315,7 +315,7 @@
    do{
       get_user_parameter_info(arg1, "v");
       get_user_parameter_info(arg2, "x");
- NTL::RR (*fp)(NTL::RR, NTL::RR);
+ boost::math::ntl::RR (*fp)(boost::math::ntl::RR, boost::math::ntl::RR);
       if(functype == func_J)
          fp = cyl_bessel_j_bare;
       else if(functype == func_I)

Modified: sandbox/math_toolkit/libs/math/tools/beta_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/beta_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/beta_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -3,7 +3,7 @@
 // Boost Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/math/special_functions/gamma.hpp>
 #include <boost/math/constants/constants.hpp>
 #include <boost/math/tools/test.hpp>
@@ -15,12 +15,12 @@
 
 struct beta_data_generator
 {
- NTL::RR operator()(NTL::RR a, NTL::RR b)
+ boost::math::ntl::RR operator()(boost::math::ntl::RR a, boost::math::ntl::RR b)
    {
       if(a < b)
          throw std::domain_error("");
       // very naively calculate spots:
- NTL::RR g1, g2, g3;
+ boost::math::ntl::RR g1, g2, g3;
       int s1, s2, s3;
       g1 = boost::math::lgamma(a, &s1);
       g2 = boost::math::lgamma(b, &s2);
@@ -35,11 +35,11 @@
 
 int main()
 {
- NTL::RR::SetPrecision(1000);
- NTL::RR::SetOutputPrecision(40);
+ boost::math::ntl::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(40);
 
- parameter_info<NTL::RR> arg1, arg2;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1, arg2;
+ test_data<boost::math::ntl::RR> data;
 
    std::cout << "Welcome.\n"
       "This program will generate spot tests for the beta function:\n"

Modified: sandbox/math_toolkit/libs/math/tools/carlson_ellint_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/carlson_ellint_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/carlson_ellint_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -4,8 +4,8 @@
 // (See accompanying file LICENSE_1_0.txt
 // or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/math/tools/ntl.hpp>
-#include <boost/math/tools/dual_precision.hpp>
+#include <boost/math/bindings/rr.hpp>
+//#include <boost/math/tools/dual_precision.hpp>
 #include <boost/math/tools/test_data.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/ellint_3.hpp>
@@ -21,42 +21,42 @@
    return *pf;
 }
 
-std::tr1::tuple<NTL::RR, NTL::RR, NTL::RR, NTL::RR> generate_rf_data(NTL::RR n)
+std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR> generate_rf_data(boost::math::ntl::RR n)
 {
    static std::tr1::mt19937 r;
    std::tr1::uniform_real<float> ur(0, 1);
    std::tr1::uniform_int<int> ui(-100, 100);
    float x = ur(r);
    x = ldexp(x, ui(r));
- NTL::RR xr(truncate_to_float(&x));
+ boost::math::ntl::RR xr(truncate_to_float(&x));
    float y = ur(r);
    y = ldexp(y, ui(r));
- NTL::RR yr(truncate_to_float(&y));
+ boost::math::ntl::RR yr(truncate_to_float(&y));
    float z = ur(r);
    z = ldexp(z, ui(r));
- NTL::RR zr(truncate_to_float(&z));
+ boost::math::ntl::RR zr(truncate_to_float(&z));
 
- NTL::RR result = boost::math::ellint_rf(xr, yr, zr);
+ boost::math::ntl::RR result = boost::math::ellint_rf(xr, yr, zr);
    return std::tr1::make_tuple(xr, yr, zr, result);
 }
 
-std::tr1::tuple<NTL::RR, NTL::RR, NTL::RR> generate_rc_data(NTL::RR n)
+std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR> generate_rc_data(boost::math::ntl::RR n)
 {
    static std::tr1::mt19937 r;
    std::tr1::uniform_real<float> ur(0, 1);
    std::tr1::uniform_int<int> ui(-100, 100);
    float x = ur(r);
    x = ldexp(x, ui(r));
- NTL::RR xr(truncate_to_float(&x));
+ boost::math::ntl::RR xr(truncate_to_float(&x));
    float y = ur(r);
    y = ldexp(y, ui(r));
- NTL::RR yr(truncate_to_float(&y));
+ boost::math::ntl::RR yr(truncate_to_float(&y));
 
- NTL::RR result = boost::math::ellint_rc(xr, yr);
+ boost::math::ntl::RR result = boost::math::ellint_rc(xr, yr);
    return std::tr1::make_tuple(xr, yr, result);
 }
 
-std::tr1::tuple<NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR> generate_rj_data(NTL::RR n)
+std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR> generate_rj_data(boost::math::ntl::RR n)
 {
    static std::tr1::mt19937 r;
    std::tr1::uniform_real<float> ur(0, 1);
@@ -64,39 +64,39 @@
    std::tr1::uniform_int<int> ui(-100, 100);
    float x = ur(r);
    x = ldexp(x, ui(r));
- NTL::RR xr(truncate_to_float(&x));
+ boost::math::ntl::RR xr(truncate_to_float(&x));
    float y = ur(r);
    y = ldexp(y, ui(r));
- NTL::RR yr(truncate_to_float(&y));
+ boost::math::ntl::RR yr(truncate_to_float(&y));
    float z = ur(r);
    z = ldexp(z, ui(r));
- NTL::RR zr(truncate_to_float(&z));
+ boost::math::ntl::RR zr(truncate_to_float(&z));
    float p = nur(r);
    p = ldexp(p, ui(r));
- NTL::RR pr(truncate_to_float(&p));
+ boost::math::ntl::RR pr(truncate_to_float(&p));
 
    boost::math::ellint_rj(x, y, z, p);
 
- NTL::RR result = boost::math::ellint_rj(xr, yr, zr, pr);
+ boost::math::ntl::RR result = boost::math::ellint_rj(xr, yr, zr, pr);
    return std::tr1::make_tuple(xr, yr, zr, pr, result);
 }
 
-std::tr1::tuple<NTL::RR, NTL::RR, NTL::RR, NTL::RR> generate_rd_data(NTL::RR n)
+std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR> generate_rd_data(boost::math::ntl::RR n)
 {
    static std::tr1::mt19937 r;
    std::tr1::uniform_real<float> ur(0, 1);
    std::tr1::uniform_int<int> ui(-100, 100);
    float x = ur(r);
    x = ldexp(x, ui(r));
- NTL::RR xr(truncate_to_float(&x));
+ boost::math::ntl::RR xr(truncate_to_float(&x));
    float y = ur(r);
    y = ldexp(y, ui(r));
- NTL::RR yr(truncate_to_float(&y));
+ boost::math::ntl::RR yr(truncate_to_float(&y));
    float z = ur(r);
    z = ldexp(z, ui(r));
- NTL::RR zr(truncate_to_float(&z));
+ boost::math::ntl::RR zr(truncate_to_float(&z));
 
- NTL::RR result = boost::math::ellint_rd(xr, yr, zr);
+ boost::math::ntl::RR result = boost::math::ellint_rd(xr, yr, zr);
    return std::tr1::make_tuple(xr, yr, zr, result);
 }
 
@@ -104,11 +104,11 @@
 {
    using namespace boost::math::tools;
 
- NTL::RR::SetOutputPrecision(50);
- NTL::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(50);
+ boost::math::ntl::RR::SetPrecision(1000);
 
- parameter_info<NTL::RR> arg1, arg2;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1, arg2;
+ test_data<boost::math::ntl::RR> data;
 
    bool cont;
    std::string line;
@@ -121,7 +121,7 @@
       std::cout << "Number of points: ";
       std::cin >> count;
       
- arg1 = make_periodic_param(NTL::RR(0), NTL::RR(1), count);
+ arg1 = make_periodic_param(boost::math::ntl::RR(0), boost::math::ntl::RR(1), count);
       arg1.type |= dummy_param;
 
       //

Modified: sandbox/math_toolkit/libs/math/tools/cbrt_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/cbrt_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/cbrt_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -3,7 +3,7 @@
 // Boost Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <fstream>
 
 #include <boost/math/tools/test_data.hpp>
@@ -13,9 +13,9 @@
 
 struct cube_data_generator
 {
- NTL::RR operator()(NTL::RR z)
+ boost::math::ntl::RR operator()(boost::math::ntl::RR z)
    {
- NTL::RR result = z*z*z;
+ boost::math::ntl::RR result = z*z*z;
       // if result is out of range of a float,
       // don't include in test data as it messes up our results:
       if(result > (std::numeric_limits<float>::max)())
@@ -28,11 +28,11 @@
 
 int main(int argc, char* argv[])
 {
- NTL::RR::SetPrecision(1000);
- NTL::RR::SetOutputPrecision(40);
+ boost::math::ntl::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(40);
 
- parameter_info<NTL::RR> arg1;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1;
+ test_data<boost::math::ntl::RR> data;
 
    std::cout << "Welcome.\n"
       "This program will generate spot tests for the cbrt function:\n\n";

Modified: sandbox/math_toolkit/libs/math/tools/digamma_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/digamma_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/digamma_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -20,7 +20,7 @@
    return external_f;
 }
 
-float truncate_to_float(NTL::RR r)
+float truncate_to_float(boost::math::ntl::RR r)
 {
    float f = boost::math::tools::real_cast<float>(r);
    return force_truncate(&f);
@@ -28,11 +28,11 @@
 
 int test_main(int argc, char*argv [])
 {
- NTL::RR::SetPrecision(1000);
- NTL::RR::SetOutputPrecision(40);
+ boost::math::ntl::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(40);
 
- parameter_info<NTL::RR> arg1;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1;
+ test_data<boost::math::ntl::RR> data;
 
    bool cont;
    std::string line;

Modified: sandbox/math_toolkit/libs/math/tools/ellint_e_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/ellint_e_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/ellint_e_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -1,4 +1,4 @@
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/math/tools/test_data.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/ellint_2.hpp>
@@ -20,11 +20,11 @@
 {
    using namespace boost::math::tools;
 
- NTL::RR::SetOutputPrecision(50);
- NTL::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(50);
+ boost::math::ntl::RR::SetPrecision(1000);
 
- parameter_info<NTL::RR> arg1;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1;
+ test_data<boost::math::ntl::RR> data;
 
    bool cont;
    std::string line;
@@ -36,7 +36,7 @@
       if(0 == get_user_parameter_info(arg1, "phi"))
          return 1;
 
- data.insert(&ellint_e_data<NTL::RR>, arg1);
+ data.insert(&ellint_e_data<boost::math::ntl::RR>, arg1);
 
       std::cout << "Any more data [y/n]?";
       std::getline(std::cin, line);

Modified: sandbox/math_toolkit/libs/math/tools/ellint_f_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/ellint_f_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/ellint_f_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -1,4 +1,4 @@
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/math/tools/test_data.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/ellint_1.hpp>
@@ -30,11 +30,11 @@
 {
    using namespace boost::math::tools;
 
- NTL::RR::SetOutputPrecision(50);
- NTL::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(50);
+ boost::math::ntl::RR::SetPrecision(1000);
 
- parameter_info<NTL::RR> arg1, arg2;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1, arg2;
+ test_data<boost::math::ntl::RR> data;
 
    bool cont;
    std::string line;
@@ -48,7 +48,7 @@
       if(0 == get_user_parameter_info(arg2, "k"))
          return 1;
 
- data.insert(&ellint_f_data<NTL::RR>, arg1, arg2);
+ data.insert(&ellint_f_data<boost::math::ntl::RR>, arg1, arg2);
 
       std::cout << "Any more data [y/n]?";
       std::getline(std::cin, line);

Modified: sandbox/math_toolkit/libs/math/tools/ellint_k_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/ellint_k_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/ellint_k_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -1,4 +1,4 @@
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/math/tools/test_data.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/ellint_1.hpp>
@@ -20,11 +20,11 @@
 {
    using namespace boost::math::tools;
 
- NTL::RR::SetOutputPrecision(50);
- NTL::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(50);
+ boost::math::ntl::RR::SetPrecision(1000);
 
- parameter_info<NTL::RR> arg1;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1;
+ test_data<boost::math::ntl::RR> data;
 
    bool cont;
    std::string line;
@@ -36,7 +36,7 @@
       if(0 == get_user_parameter_info(arg1, "phi"))
          return 1;
 
- data.insert(&ellint_k_data<NTL::RR>, arg1);
+ data.insert(&ellint_k_data<boost::math::ntl::RR>, arg1);
 
       std::cout << "Any more data [y/n]?";
       std::getline(std::cin, line);

Modified: sandbox/math_toolkit/libs/math/tools/ellint_pi2_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/ellint_pi2_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/ellint_pi2_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -3,8 +3,8 @@
 // Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt
 // or copy at http://www.boost.org/LICENSE_1_0.txt)
-#include <boost/math/tools/ntl.hpp>
-#include <boost/math/tools/dual_precision.hpp>
+#include <boost/math/bindings/rr.hpp>
+//#include <boost/math/tools/dual_precision.hpp>
 #include <boost/math/tools/test_data.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/ellint_2.hpp>
@@ -21,11 +21,11 @@
 {
    using namespace boost::math::tools;
 
- NTL::RR::SetOutputPrecision(50);
- NTL::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(50);
+ boost::math::ntl::RR::SetPrecision(1000);
 
- parameter_info<NTL::RR> arg1, arg2;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1, arg2;
+ test_data<boost::math::ntl::RR> data;
 
    bool cont;
    std::string line;
@@ -39,7 +39,7 @@
       if(0 == get_user_parameter_info(arg2, "k"))
          return 1;
 
- NTL::RR (*fp)(NTL::RR, NTL::RR) = &ellint_3;
+ boost::math::ntl::RR (*fp)(boost::math::ntl::RR, boost::math::ntl::RR) = &ellint_3;
       data.insert(fp, arg2, arg1);
 
       std::cout << "Any more data [y/n]?";

Modified: sandbox/math_toolkit/libs/math/tools/ellint_pi3_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/ellint_pi3_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/ellint_pi3_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -6,8 +6,8 @@
 // or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 
-#include <boost/math/tools/ntl.hpp>
-#include <boost/math/tools/dual_precision.hpp>
+#include <boost/math/bindings/rr.hpp>
+//#include <boost/math/tools/dual_precision.hpp>
 #include <boost/math/tools/test_data.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/ellint_3.hpp>
@@ -23,13 +23,13 @@
    return *pf;
 }
 
-std::tr1::tuple<NTL::RR, NTL::RR> generate_data(NTL::RR n, NTL::RR phi)
+std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR> generate_data(boost::math::ntl::RR n, boost::math::ntl::RR phi)
 {
    static std::tr1::mt19937 r;
    std::tr1::uniform_real<float> ui(0, 1);
    float k = ui(r);
- NTL::RR kr(truncate_to_float(&k));
- NTL::RR result = boost::math::ellint_3(kr, n, phi);
+ boost::math::ntl::RR kr(truncate_to_float(&k));
+ boost::math::ntl::RR result = boost::math::ellint_3(kr, n, phi);
    return std::tr1::make_tuple(kr, result);
 }
 
@@ -37,11 +37,11 @@
 {
    using namespace boost::math::tools;
 
- NTL::RR::SetOutputPrecision(50);
- NTL::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(50);
+ boost::math::ntl::RR::SetPrecision(1000);
 
- parameter_info<NTL::RR> arg1, arg2;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1, arg2;
+ test_data<boost::math::ntl::RR> data;
 
    bool cont;
    std::string line;

Modified: sandbox/math_toolkit/libs/math/tools/erf_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/erf_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/erf_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -3,7 +3,7 @@
 // Boost Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/gamma.hpp>
 #include <boost/math/special_functions/erf.hpp> // for inverses
@@ -25,7 +25,7 @@
    return external_f;
 }
 
-float truncate_to_float(NTL::RR r)
+float truncate_to_float(boost::math::ntl::RR r)
 {
    float f = boost::math::tools::real_cast<float>(r);
    return force_truncate(&f);
@@ -33,7 +33,7 @@
 
 struct erf_data_generator
 {
- std::tr1::tuple<NTL::RR, NTL::RR> operator()(NTL::RR z)
+ std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR> operator()(boost::math::ntl::RR z)
    {
       // very naively calculate spots using the gamma function at high precision:
       int sign = 1;
@@ -42,9 +42,9 @@
          sign = -1;
          z = -z;
       }
- NTL::RR g1, g2;
- g1 = boost::math::tgamma_lower(NTL::RR(0.5), z * z);
- g1 /= sqrt(boost::math::constants::pi<NTL::RR>());
+ boost::math::ntl::RR g1, g2;
+ g1 = boost::math::tgamma_lower(boost::math::ntl::RR(0.5), z * z);
+ g1 /= sqrt(boost::math::constants::pi<boost::math::ntl::RR>());
       g1 *= sign;
 
       if(z < 0.5)
@@ -53,8 +53,8 @@
       }
       else
       {
- g2 = boost::math::tgamma(NTL::RR(0.5), z * z);
- g2 /= sqrt(boost::math::constants::pi<NTL::RR>());
+ g2 = boost::math::tgamma(boost::math::ntl::RR(0.5), z * z);
+ g2 /= sqrt(boost::math::constants::pi<boost::math::ntl::RR>());
       }
       if(sign < 1)
          g2 = 2 - g2;
@@ -119,12 +119,12 @@
       << terms << " terms." << std::endl;
 }
 
-std::tr1::tuple<NTL::RR, NTL::RR> erfc_inv(NTL::RR r)
+std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR> erfc_inv(boost::math::ntl::RR r)
 {
- NTL::RR x = exp(-r * r);
- x = NTL::RoundToPrecision(x, 64);
+ boost::math::ntl::RR x = exp(-r * r);
+ x = NTL::RoundToPrecision(x.value(), 64);
    std::cout << x << " ";
- NTL::RR result = boost::math::erfc_inv(x);
+ boost::math::ntl::RR result = boost::math::erfc_inv(x);
    std::cout << result << std::endl;
    return std::tr1::make_tuple(x, result);
 }
@@ -132,11 +132,11 @@
 
 int test_main(int argc, char*argv [])
 {
- NTL::RR::SetPrecision(1000);
- NTL::RR::SetOutputPrecision(40);
+ boost::math::ntl::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(40);
 
- parameter_info<NTL::RR> arg1;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1;
+ test_data<boost::math::ntl::RR> data;
 
    bool cont;
    std::string line;
@@ -154,18 +154,18 @@
       }
       else if(strcmp(argv[1], "--erf_inv") == 0)
       {
- NTL::RR (*f)(NTL::RR);
+ boost::math::ntl::RR (*f)(boost::math::ntl::RR);
          f = boost::math::erf_inv;
          std::cout << "Welcome.\n"
             "This program will generate spot tests for the inverse erf function:\n";
          std::cout << "Enter the number of data points: ";
          int points;
          std::cin >> points;
- data.insert(f, make_random_param(NTL::RR(-1), NTL::RR(1), points));
+ data.insert(f, make_random_param(boost::math::ntl::RR(-1), boost::math::ntl::RR(1), points));
       }
       else if(strcmp(argv[1], "--erfc_inv") == 0)
       {
- std::tr1::tuple<NTL::RR, NTL::RR> (*f)(NTL::RR);
+ std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR> (*f)(boost::math::ntl::RR);
          f = erfc_inv;
          std::cout << "Welcome.\n"
             "This program will generate spot tests for the inverse erfc function:\n";
@@ -175,7 +175,7 @@
          std::cout << "Enter the number of data points: ";
          int points;
          std::cin >> points;
- parameter_info<NTL::RR> arg = make_random_param(NTL::RR(0), NTL::RR(max_val), points);
+ parameter_info<boost::math::ntl::RR> arg = make_random_param(boost::math::ntl::RR(0), boost::math::ntl::RR(max_val), points);
          arg.type |= dummy_param;
          data.insert(f, arg);
       }

Modified: sandbox/math_toolkit/libs/math/tools/factorial_tables.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/factorial_tables.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/factorial_tables.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -1,16 +1,16 @@
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/limits.hpp>
 #include <vector>
 
 void write_table(unsigned max_exponent)
 {
- NTL::RR max = ldexp(NTL::RR(1), max_exponent);
+ boost::math::ntl::RR max = ldexp(boost::math::ntl::RR(1), max_exponent);
 
- std::vector<NTL::RR> factorials;
+ std::vector<boost::math::ntl::RR> factorials;
    factorials.push_back(1);
 
- NTL::RR f(1);
+ boost::math::ntl::RR f(1);
    unsigned i = 1;
 
    while(f < max)
@@ -33,7 +33,7 @@
 
 int main()
 {
- NTL::RR::SetPrecision(300);
- NTL::RR::SetOutputPrecision(40);
+ boost::math::ntl::RR::SetPrecision(300);
+ boost::math::ntl::RR::SetOutputPrecision(40);
    write_table(16384/*std::numeric_limits<float>::max_exponent*/);
 }

Modified: sandbox/math_toolkit/libs/math/tools/gamma_P_inva_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/gamma_P_inva_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/gamma_P_inva_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -3,7 +3,7 @@
 // Boost Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/gamma.hpp>
 #include <boost/math/constants/constants.hpp>
@@ -29,7 +29,7 @@
    return external_f;
 }
 
-float truncate_to_float(NTL::RR r)
+float truncate_to_float(boost::math::ntl::RR r)
 {
    float f = boost::math::tools::real_cast<float>(r);
    return force_truncate(&f);
@@ -37,10 +37,10 @@
 
 struct gamma_inverse_generator_a
 {
- std::tr1::tuple<NTL::RR, NTL::RR> operator()(const NTL::RR x, const NTL::RR p)
+ std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR> operator()(const boost::math::ntl::RR x, const boost::math::ntl::RR p)
    {
- NTL::RR x1 = boost::math::gamma_p_inva(x, p);
- NTL::RR x2 = boost::math::gamma_q_inva(x, p);
+ boost::math::ntl::RR x1 = boost::math::gamma_p_inva(x, p);
+ boost::math::ntl::RR x2 = boost::math::gamma_q_inva(x, p);
       std::cout << "Inverse for " << x << " " << p << std::endl;
       return std::tr1::make_tuple(x1, x2);
    }
@@ -49,21 +49,21 @@
 
 int test_main(int argc, char*argv [])
 {
- NTL::RR::SetPrecision(1000);
- NTL::RR::SetOutputPrecision(100);
+ boost::math::ntl::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(100);
 
    bool cont;
    std::string line;
 
- parameter_info<NTL::RR> arg1, arg2;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1, arg2;
+ test_data<boost::math::ntl::RR> data;
 
    std::cout << "Welcome.\n"
       "This program will generate spot tests for the inverse incomplete gamma function:\n"
       " gamma_p_inva(a, p) and gamma_q_inva(a, q)\n\n";
 
- arg1 = make_power_param<NTL::RR>(NTL::RR(0), -4, 24);
- arg2 = make_random_param<NTL::RR>(NTL::RR(0), NTL::RR(1), 15);
+ arg1 = make_power_param<boost::math::ntl::RR>(boost::math::ntl::RR(0), -4, 24);
+ arg2 = make_random_param<boost::math::ntl::RR>(boost::math::ntl::RR(0), boost::math::ntl::RR(1), 15);
    data.insert(gamma_inverse_generator_a(), arg1, arg2);
  
    line = "igamma_inva_data.ipp";

Modified: sandbox/math_toolkit/libs/math/tools/generate_rational_test.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/generate_rational_test.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/generate_rational_test.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -2,7 +2,7 @@
 #define BOOST_MATH_POLY_METHOD 0
 #define BOOST_MATH_RATIONAL_METHOD 0
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/tr1/random.hpp>
 #include <boost/math/tools/rational.hpp>
 #include <iostream>
@@ -15,8 +15,8 @@
 
    static const unsigned max_order = 20;
 
- NTL::RR::SetPrecision(500);
- NTL::RR::SetOutputPrecision(40);
+ boost::math::ntl::RR::SetPrecision(500);
+ boost::math::ntl::RR::SetOutputPrecision(40);
 
    std::tr1::mt19937 rnd;
    std::tr1::variate_generator<
@@ -53,12 +53,12 @@
       }
       std::cout << " };\n";
 
- NTL::RR r1 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.125), i);
- NTL::RR r2 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.25), i);
- NTL::RR r3 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.75), i);
- NTL::RR r4 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(1) - NTL::RR(1) / 64, i);
- NTL::RR r5 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(6.5), i);
- NTL::RR r6 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(10247.25), i);
+ boost::math::ntl::RR r1 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.125), i);
+ boost::math::ntl::RR r2 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.25), i);
+ boost::math::ntl::RR r3 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.75), i);
+ boost::math::ntl::RR r4 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(1) - boost::math::ntl::RR(1) / 64, i);
+ boost::math::ntl::RR r5 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(6.5), i);
+ boost::math::ntl::RR r6 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(10247.25), i);
 
       std::cout <<
          " BOOST_CHECK_CLOSE(\n"
@@ -159,12 +159,12 @@
             " static_cast<T>(" << r6 << "L),\n"
             " tolerance);\n\n";
 
- r1 = boost::math::tools::evaluate_even_polynomial(&coef[0], NTL::RR(0.125), i);
- r2 = boost::math::tools::evaluate_even_polynomial(&coef[0], NTL::RR(0.25), i);
- r3 = boost::math::tools::evaluate_even_polynomial(&coef[0], NTL::RR(0.75), i);
- r4 = boost::math::tools::evaluate_even_polynomial(&coef[0], NTL::RR(1) - NTL::RR(1) / 64, i);
- r5 = boost::math::tools::evaluate_even_polynomial(&coef[0], NTL::RR(6.5), i);
- r6 = boost::math::tools::evaluate_even_polynomial(&coef[0], NTL::RR(10247.25), i);
+ r1 = boost::math::tools::evaluate_even_polynomial(&coef[0], boost::math::ntl::RR(0.125), i);
+ r2 = boost::math::tools::evaluate_even_polynomial(&coef[0], boost::math::ntl::RR(0.25), i);
+ r3 = boost::math::tools::evaluate_even_polynomial(&coef[0], boost::math::ntl::RR(0.75), i);
+ r4 = boost::math::tools::evaluate_even_polynomial(&coef[0], boost::math::ntl::RR(1) - boost::math::ntl::RR(1) / 64, i);
+ r5 = boost::math::tools::evaluate_even_polynomial(&coef[0], boost::math::ntl::RR(6.5), i);
+ r6 = boost::math::tools::evaluate_even_polynomial(&coef[0], boost::math::ntl::RR(10247.25), i);
 
       std::cout <<
          " BOOST_CHECK_CLOSE(\n"
@@ -267,12 +267,12 @@
 
       if(i > 1)
       {
- r1 = boost::math::tools::evaluate_odd_polynomial(&coef[0], NTL::RR(0.125), i);
- r2 = boost::math::tools::evaluate_odd_polynomial(&coef[0], NTL::RR(0.25), i);
- r3 = boost::math::tools::evaluate_odd_polynomial(&coef[0], NTL::RR(0.75), i);
- r4 = boost::math::tools::evaluate_odd_polynomial(&coef[0], NTL::RR(1) - NTL::RR(1) / 64, i);
- r5 = boost::math::tools::evaluate_odd_polynomial(&coef[0], NTL::RR(6.5), i);
- r6 = boost::math::tools::evaluate_odd_polynomial(&coef[0], NTL::RR(10247.25), i);
+ r1 = boost::math::tools::evaluate_odd_polynomial(&coef[0], boost::math::ntl::RR(0.125), i);
+ r2 = boost::math::tools::evaluate_odd_polynomial(&coef[0], boost::math::ntl::RR(0.25), i);
+ r3 = boost::math::tools::evaluate_odd_polynomial(&coef[0], boost::math::ntl::RR(0.75), i);
+ r4 = boost::math::tools::evaluate_odd_polynomial(&coef[0], boost::math::ntl::RR(1) - boost::math::ntl::RR(1) / 64, i);
+ r5 = boost::math::tools::evaluate_odd_polynomial(&coef[0], boost::math::ntl::RR(6.5), i);
+ r6 = boost::math::tools::evaluate_odd_polynomial(&coef[0], boost::math::ntl::RR(10247.25), i);
 
          std::cout <<
             " BOOST_CHECK_CLOSE(\n"
@@ -374,12 +374,12 @@
                " tolerance);\n\n";
       }
 
- r1 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.125), i);
- r2 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.25), i);
- r3 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.75), i);
- r4 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(1) - NTL::RR(1) / 64, i);
- r5 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(6.5), i);
- r6 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(10247.25), i);
+ r1 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.125), i);
+ r2 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.25), i);
+ r3 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.75), i);
+ r4 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(1) - boost::math::ntl::RR(1) / 64, i);
+ r5 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(6.5), i);
+ r6 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(10247.25), i);
 
       coef.clear();
       for(unsigned j = 0; j < i; ++j)
@@ -408,12 +408,12 @@
       }
       std::cout << " };\n";
 
- NTL::RR r1d = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.125), i);
- NTL::RR r2d = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.25), i);
- NTL::RR r3d = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.75), i);
- NTL::RR r4d = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(1) - NTL::RR(1) / 64, i);
- NTL::RR r5d = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(6.5), i);
- NTL::RR r6d = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(10247.25), i);
+ boost::math::ntl::RR r1d = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.125), i);
+ boost::math::ntl::RR r2d = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.25), i);
+ boost::math::ntl::RR r3d = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.75), i);
+ boost::math::ntl::RR r4d = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(1) - boost::math::ntl::RR(1) / 64, i);
+ boost::math::ntl::RR r5d = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(6.5), i);
+ boost::math::ntl::RR r6d = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(10247.25), i);
 
       std::cout <<
          " BOOST_CHECK_CLOSE(\n"

Modified: sandbox/math_toolkit/libs/math/tools/hermite_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/hermite_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/hermite_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -1,5 +1,5 @@
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/math/tools/test_data.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/hermite.hpp>
@@ -24,13 +24,13 @@
 {
    using namespace boost::math::tools;
 
- NTL::RR::SetOutputPrecision(50);
- NTL::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(50);
+ boost::math::ntl::RR::SetPrecision(1000);
 
- parameter_info<NTL::RR> arg1, arg2, arg3;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1, arg2, arg3;
+ test_data<boost::math::ntl::RR> data;
 
- std::cout << boost::math::hermite(10, static_cast<NTL::RR>(1e300)) << std::endl;
+ std::cout << boost::math::hermite(10, static_cast<boost::math::ntl::RR>(1e300)) << std::endl;
 
    bool cont;
    std::string line;
@@ -46,7 +46,7 @@
       arg1.type |= dummy_param;
       arg2.type |= dummy_param;
 
- data.insert(&hermite_data<NTL::RR>, arg1, arg2);
+ data.insert(&hermite_data<boost::math::ntl::RR>, arg1, arg2);
 
       std::cout << "Any more data [y/n]?";
       std::getline(std::cin, line);

Modified: sandbox/math_toolkit/libs/math/tools/ibeta_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/ibeta_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/ibeta_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -3,7 +3,7 @@
 // Boost Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/gamma.hpp>
 #include <boost/math/special_functions/beta.hpp>
@@ -87,7 +87,7 @@
 T get_ibeta_fraction1(T a, T b, T x)
 {
    ibeta_fraction1_t<T> f(a, b, x);
- T fract = boost::math::tools::continued_fraction_a(f, boost::math::policies::digits<T, boost::math::policies<> >());
+ T fract = boost::math::tools::continued_fraction_a(f, boost::math::policies::digits<T, boost::math::policies::policy<> >());
    T denom = (a * (fract + 1));
    T num = pow(x, a) * pow(1 - x, b);
    if(num == 0)
@@ -166,7 +166,7 @@
    return external_f;
 }
 
-float truncate_to_float(NTL::RR r)
+float truncate_to_float(boost::math::ntl::RR r)
 {
    float f = boost::math::tools::real_cast<float>(r);
    return force_truncate(&f);
@@ -180,14 +180,14 @@
 
 struct beta_data_generator
 {
- std::tr1::tuple<NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR> operator()(NTL::RR ap, NTL::RR bp, NTL::RR x_)
+ std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR> operator()(boost::math::ntl::RR ap, boost::math::ntl::RR bp, boost::math::ntl::RR x_)
    {
- float a = truncate_to_float(real_cast<float>(gen() * pow(NTL::RR(10), ap)));
- float b = truncate_to_float(real_cast<float>(gen() * pow(NTL::RR(10), bp)));
+ float a = truncate_to_float(real_cast<float>(gen() * pow(boost::math::ntl::RR(10), ap)));
+ float b = truncate_to_float(real_cast<float>(gen() * pow(boost::math::ntl::RR(10), bp)));
       float x = truncate_to_float(real_cast<float>(x_));
       std::cout << a << " " << b << " " << x << std::endl;
- std::pair<NTL::RR, NTL::RR> ib_full = ibeta_fraction1(NTL::RR(a), NTL::RR(b), NTL::RR(x));
- std::pair<NTL::RR, NTL::RR> ib_reg = ibeta_fraction1_regular(NTL::RR(a), NTL::RR(b), NTL::RR(x));
+ std::pair<boost::math::ntl::RR, boost::math::ntl::RR> ib_full = ibeta_fraction1(boost::math::ntl::RR(a), boost::math::ntl::RR(b), boost::math::ntl::RR(x));
+ std::pair<boost::math::ntl::RR, boost::math::ntl::RR> ib_reg = ibeta_fraction1_regular(boost::math::ntl::RR(a), boost::math::ntl::RR(b), boost::math::ntl::RR(x));
       return std::tr1::make_tuple(a, b, x, ib_full.first, ib_full.second, ib_reg.first, ib_reg.second);
    }
 };
@@ -195,71 +195,71 @@
 // medium sized values:
 struct beta_data_generator_medium
 {
- std::tr1::tuple<NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR> operator()(NTL::RR x_)
+ std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR> operator()(boost::math::ntl::RR x_)
    {
- NTL::RR a = gen2();
- NTL::RR b = gen2();
- NTL::RR x = x_;
- a = ConvPrec(a, 22);
- b = ConvPrec(b, 22);
- x = ConvPrec(x, 22);
+ boost::math::ntl::RR a = gen2();
+ boost::math::ntl::RR b = gen2();
+ boost::math::ntl::RR x = x_;
+ a = ConvPrec(a.value(), 22);
+ b = ConvPrec(b.value(), 22);
+ x = ConvPrec(x.value(), 22);
       std::cout << a << " " << b << " " << x << std::endl;
- //NTL::RR exp_beta = boost::math::beta(a, b, x);
- std::pair<NTL::RR, NTL::RR> ib_full = ibeta_fraction1(NTL::RR(a), NTL::RR(b), NTL::RR(x));
+ //boost::math::ntl::RR exp_beta = boost::math::beta(a, b, x);
+ std::pair<boost::math::ntl::RR, boost::math::ntl::RR> ib_full = ibeta_fraction1(boost::math::ntl::RR(a), boost::math::ntl::RR(b), boost::math::ntl::RR(x));
       /*exp_beta = boost::math::tools::relative_error(ib_full.first, exp_beta);
       if(exp_beta > 1e-40)
       {
          std::cout << exp_beta << std::endl;
       }*/
- std::pair<NTL::RR, NTL::RR> ib_reg = ibeta_fraction1_regular(NTL::RR(a), NTL::RR(b), NTL::RR(x));
+ std::pair<boost::math::ntl::RR, boost::math::ntl::RR> ib_reg = ibeta_fraction1_regular(boost::math::ntl::RR(a), boost::math::ntl::RR(b), boost::math::ntl::RR(x));
       return std::tr1::make_tuple(a, b, x, ib_full.first, ib_full.second, ib_reg.first, ib_reg.second);
    }
 };
 
 struct beta_data_generator_small
 {
- std::tr1::tuple<NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR> operator()(NTL::RR x_)
+ std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR> operator()(boost::math::ntl::RR x_)
    {
       float a = truncate_to_float(gen2()/10);
       float b = truncate_to_float(gen2()/10);
       float x = truncate_to_float(real_cast<float>(x_));
       std::cout << a << " " << b << " " << x << std::endl;
- std::pair<NTL::RR, NTL::RR> ib_full = ibeta_fraction1(NTL::RR(a), NTL::RR(b), NTL::RR(x));
- std::pair<NTL::RR, NTL::RR> ib_reg = ibeta_fraction1_regular(NTL::RR(a), NTL::RR(b), NTL::RR(x));
+ std::pair<boost::math::ntl::RR, boost::math::ntl::RR> ib_full = ibeta_fraction1(boost::math::ntl::RR(a), boost::math::ntl::RR(b), boost::math::ntl::RR(x));
+ std::pair<boost::math::ntl::RR, boost::math::ntl::RR> ib_reg = ibeta_fraction1_regular(boost::math::ntl::RR(a), boost::math::ntl::RR(b), boost::math::ntl::RR(x));
       return std::tr1::make_tuple(a, b, x, ib_full.first, ib_full.second, ib_reg.first, ib_reg.second);
    }
 };
 
 struct beta_data_generator_int
 {
- std::tr1::tuple<NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR> operator()(NTL::RR a, NTL::RR b, NTL::RR x_)
+ std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR> operator()(boost::math::ntl::RR a, boost::math::ntl::RR b, boost::math::ntl::RR x_)
    {
       float x = truncate_to_float(real_cast<float>(x_));
       std::cout << a << " " << b << " " << x << std::endl;
- std::pair<NTL::RR, NTL::RR> ib_full = ibeta_fraction1(a, b, NTL::RR(x));
- std::pair<NTL::RR, NTL::RR> ib_reg = ibeta_fraction1_regular(a, b, NTL::RR(x));
+ std::pair<boost::math::ntl::RR, boost::math::ntl::RR> ib_full = ibeta_fraction1(a, b, boost::math::ntl::RR(x));
+ std::pair<boost::math::ntl::RR, boost::math::ntl::RR> ib_reg = ibeta_fraction1_regular(a, b, boost::math::ntl::RR(x));
       return std::tr1::make_tuple(a, b, x, ib_full.first, ib_full.second, ib_reg.first, ib_reg.second);
    }
 };
 
 int test_main(int, char* [])
 {
- NTL::RR::SetPrecision(1000);
- NTL::RR::SetOutputPrecision(40);
+ boost::math::ntl::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(40);
 
- parameter_info<NTL::RR> arg1, arg2, arg3, arg4, arg5;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1, arg2, arg3, arg4, arg5;
+ test_data<boost::math::ntl::RR> data;
 
    std::cout << "Welcome.\n"
       "This program will generate spot tests for the incomplete beta functions:\n"
       " beta(a, b, x) and ibeta(a, b, x)\n\n"
       "This is not an interactive program be prepared for a long wait!!!\n\n";
 
- arg1 = make_periodic_param(NTL::RR(-5), NTL::RR(6), 11);
- arg2 = make_periodic_param(NTL::RR(-5), NTL::RR(6), 11);
- arg3 = make_random_param(NTL::RR(0.0001), NTL::RR(1), 10);
- arg4 = make_random_param(NTL::RR(0.0001), NTL::RR(1), 100 /*500*/);
- arg5 = make_periodic_param(NTL::RR(1), NTL::RR(41), 10);
+ arg1 = make_periodic_param(boost::math::ntl::RR(-5), boost::math::ntl::RR(6), 11);
+ arg2 = make_periodic_param(boost::math::ntl::RR(-5), boost::math::ntl::RR(6), 11);
+ arg3 = make_random_param(boost::math::ntl::RR(0.0001), boost::math::ntl::RR(1), 10);
+ arg4 = make_random_param(boost::math::ntl::RR(0.0001), boost::math::ntl::RR(1), 100 /*500*/);
+ arg5 = make_periodic_param(boost::math::ntl::RR(1), boost::math::ntl::RR(41), 10);
 
    arg1.type |= dummy_param;
    arg2.type |= dummy_param;
@@ -274,16 +274,16 @@
    //data.insert(beta_data_generator_small(), arg4);
    data.insert(beta_data_generator_int(), arg5, arg5, arg3);
 
- test_data<NTL::RR>::const_iterator i, j;
+ test_data<boost::math::ntl::RR>::const_iterator i, j;
    i = data.begin();
    j = data.end();
    while(i != j)
    {
- NTL::RR v1 = beta((*i)[0], (*i)[1], (*i)[2]);
- NTL::RR v2 = relative_error(v1, (*i)[3]);
+ boost::math::ntl::RR v1 = beta((*i)[0], (*i)[1], (*i)[2]);
+ boost::math::ntl::RR v2 = relative_error(v1, (*i)[3]);
       std::string s = boost::lexical_cast<std::string>((*i)[3]);
- NTL::RR v3 = boost::lexical_cast<NTL::RR>(s);
- NTL::RR v4 = relative_error(v3, (*i)[3]);
+ boost::math::ntl::RR v3 = boost::lexical_cast<boost::math::ntl::RR>(s);
+ boost::math::ntl::RR v4 = relative_error(v3, (*i)[3]);
       if(v2 > 1e-40)
       {
          std::cout << v2 << std::endl;

Modified: sandbox/math_toolkit/libs/math/tools/ibeta_inv_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/ibeta_inv_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/ibeta_inv_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -4,7 +4,7 @@
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #if 1
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/beta.hpp>
 #include <boost/math/constants/constants.hpp>
@@ -30,7 +30,7 @@
    return external_f;
 }
 
-float truncate_to_float(NTL::RR r)
+float truncate_to_float(boost::math::ntl::RR r)
 {
    float f = boost::math::tools::real_cast<float>(r);
    return force_truncate(&f);
@@ -44,15 +44,15 @@
 
 struct ibeta_inv_data_generator
 {
- std::tr1::tuple<NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR> operator()(NTL::RR ap, NTL::RR bp, NTL::RR x_)
+ std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR> operator()(boost::math::ntl::RR ap, boost::math::ntl::RR bp, boost::math::ntl::RR x_)
    {
- float a = truncate_to_float(real_cast<float>(gen() * pow(NTL::RR(10), ap)));
- float b = truncate_to_float(real_cast<float>(gen() * pow(NTL::RR(10), bp)));
+ float a = truncate_to_float(real_cast<float>(gen() * pow(boost::math::ntl::RR(10), ap)));
+ float b = truncate_to_float(real_cast<float>(gen() * pow(boost::math::ntl::RR(10), bp)));
       float x = truncate_to_float(real_cast<float>(x_));
       std::cout << a << " " << b << " " << x << std::flush;
- NTL::RR inv = boost::math::ibeta_inv(NTL::RR(a), NTL::RR(b), NTL::RR(x));
+ boost::math::ntl::RR inv = boost::math::ibeta_inv(boost::math::ntl::RR(a), boost::math::ntl::RR(b), boost::math::ntl::RR(x));
       std::cout << " " << inv << std::flush;
- NTL::RR invc = boost::math::ibetac_inv(NTL::RR(a), NTL::RR(b), NTL::RR(x));
+ boost::math::ntl::RR invc = boost::math::ibetac_inv(boost::math::ntl::RR(a), boost::math::ntl::RR(b), boost::math::ntl::RR(x));
       std::cout << " " << invc << std::endl;
       return std::tr1::make_tuple(a, b, x, inv, invc);
    }
@@ -60,22 +60,22 @@
 
 int test_main(int argc, char*argv [])
 {
- NTL::RR::SetPrecision(1000);
- NTL::RR::SetOutputPrecision(100);
+ boost::math::ntl::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(100);
 
    bool cont;
    std::string line;
 
- parameter_info<NTL::RR> arg1, arg2, arg3;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1, arg2, arg3;
+ test_data<boost::math::ntl::RR> data;
 
    std::cout << "Welcome.\n"
       "This program will generate spot tests for the inverse incomplete beta function:\n"
       " ibeta_inv(a, p) and ibetac_inv(a, q)\n\n";
 
- arg1 = make_periodic_param(NTL::RR(-5), NTL::RR(6), 11);
- arg2 = make_periodic_param(NTL::RR(-5), NTL::RR(6), 11);
- arg3 = make_random_param(NTL::RR(0.0001), NTL::RR(1), 10);
+ arg1 = make_periodic_param(boost::math::ntl::RR(-5), boost::math::ntl::RR(6), 11);
+ arg2 = make_periodic_param(boost::math::ntl::RR(-5), boost::math::ntl::RR(6), 11);
+ arg3 = make_random_param(boost::math::ntl::RR(0.0001), boost::math::ntl::RR(1), 10);
 
    arg1.type |= dummy_param;
    arg2.type |= dummy_param;

Modified: sandbox/math_toolkit/libs/math/tools/ibeta_invab_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/ibeta_invab_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/ibeta_invab_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -3,7 +3,7 @@
 // Boost Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/beta.hpp>
 #include <boost/math/constants/constants.hpp>
@@ -29,7 +29,7 @@
    return external_f;
 }
 
-float truncate_to_float(NTL::RR r)
+float truncate_to_float(boost::math::ntl::RR r)
 {
    float f = boost::math::tools::real_cast<float>(r);
    return force_truncate(&f);
@@ -43,20 +43,20 @@
 
 struct ibeta_inv_data_generator
 {
- std::tr1::tuple<NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR> operator()
- (NTL::RR bp, NTL::RR x_, NTL::RR p_)
+ std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR> operator()
+ (boost::math::ntl::RR bp, boost::math::ntl::RR x_, boost::math::ntl::RR p_)
    {
- float b = truncate_to_float(real_cast<float>(gen() * pow(NTL::RR(10), bp)));
+ float b = truncate_to_float(real_cast<float>(gen() * pow(boost::math::ntl::RR(10), bp)));
       float x = truncate_to_float(real_cast<float>(x_));
       float p = truncate_to_float(real_cast<float>(p_));
       std::cout << b << " " << x << " " << p << std::flush;
- NTL::RR inv = boost::math::ibeta_inva(NTL::RR(b), NTL::RR(x), NTL::RR(p));
+ boost::math::ntl::RR inv = boost::math::ibeta_inva(boost::math::ntl::RR(b), boost::math::ntl::RR(x), boost::math::ntl::RR(p));
       std::cout << " " << inv << std::flush;
- NTL::RR invc = boost::math::ibetac_inva(NTL::RR(b), NTL::RR(x), NTL::RR(p));
+ boost::math::ntl::RR invc = boost::math::ibetac_inva(boost::math::ntl::RR(b), boost::math::ntl::RR(x), boost::math::ntl::RR(p));
       std::cout << " " << invc << std::endl;
- NTL::RR invb = boost::math::ibeta_invb(NTL::RR(b), NTL::RR(x), NTL::RR(p));
+ boost::math::ntl::RR invb = boost::math::ibeta_invb(boost::math::ntl::RR(b), boost::math::ntl::RR(x), boost::math::ntl::RR(p));
       std::cout << " " << invb << std::flush;
- NTL::RR invbc = boost::math::ibetac_invb(NTL::RR(b), NTL::RR(x), NTL::RR(p));
+ boost::math::ntl::RR invbc = boost::math::ibetac_invb(boost::math::ntl::RR(b), boost::math::ntl::RR(x), boost::math::ntl::RR(p));
       std::cout << " " << invbc << std::endl;
       return std::tr1::make_tuple(b, x, p, inv, invc, invb, invbc);
    }
@@ -64,22 +64,22 @@
 
 int test_main(int argc, char*argv [])
 {
- NTL::RR::SetPrecision(1000);
- NTL::RR::SetOutputPrecision(100);
+ boost::math::ntl::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(100);
 
    bool cont;
    std::string line;
 
- parameter_info<NTL::RR> arg1, arg2, arg3;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1, arg2, arg3;
+ test_data<boost::math::ntl::RR> data;
 
    std::cout << "Welcome.\n"
       "This program will generate spot tests for the inverse incomplete beta function:\n"
       " ibeta_inva(a, p) and ibetac_inva(a, q)\n\n";
 
- arg1 = make_periodic_param(NTL::RR(-5), NTL::RR(6), 11);
- arg2 = make_random_param(NTL::RR(0.0001), NTL::RR(1), 10);
- arg3 = make_random_param(NTL::RR(0.0001), NTL::RR(1), 10);
+ arg1 = make_periodic_param(boost::math::ntl::RR(-5), boost::math::ntl::RR(6), 11);
+ arg2 = make_random_param(boost::math::ntl::RR(0.0001), boost::math::ntl::RR(1), 10);
+ arg3 = make_random_param(boost::math::ntl::RR(0.0001), boost::math::ntl::RR(1), 10);
 
    arg1.type |= dummy_param;
    arg2.type |= dummy_param;

Modified: sandbox/math_toolkit/libs/math/tools/igamma_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/igamma_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/igamma_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -3,7 +3,7 @@
 // Boost Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/gamma.hpp>
 #include <boost/math/constants/constants.hpp>
@@ -29,7 +29,7 @@
    return external_f;
 }
 
-float truncate_to_float(NTL::RR r)
+float truncate_to_float(boost::math::ntl::RR r)
 {
    float f = boost::math::tools::real_cast<float>(r);
    return force_truncate(&f);
@@ -43,14 +43,14 @@
 //
 struct igamma_data_generator
 {
- std::tr1::tuple<NTL::RR, NTL::RR, NTL::RR, NTL::RR, NTL::RR> operator()(NTL::RR a, NTL::RR x)
+ std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR, boost::math::ntl::RR> operator()(boost::math::ntl::RR a, boost::math::ntl::RR x)
    {
       // very naively calculate spots:
- NTL::RR z;
+ boost::math::ntl::RR z;
       switch((int)real_cast<float>(x))
       {
       case 1:
- z = truncate_to_float((std::min)(NTL::RR(1), a/100));
+ z = truncate_to_float((std::min)(boost::math::ntl::RR(1), a/100));
          break;
       case 2:
          z = truncate_to_float(a / 2);
@@ -68,17 +68,17 @@
          z = truncate_to_float(a * 2);
          break;
       case 7:
- z = truncate_to_float((std::max)(NTL::RR(100), a*100));
+ z = truncate_to_float((std::max)(boost::math::ntl::RR(100), a*100));
          break;
       default:
          BOOST_ASSERT(0 == "Can't get here!!");
       }
 
- //NTL::RR g = boost::math::tgamma(a);
- NTL::RR lg = boost::math::tgamma_lower(a, z);
- NTL::RR ug = boost::math::tgamma(a, z);
- NTL::RR rlg = boost::math::gamma_p(a, z);
- NTL::RR rug = boost::math::gamma_q(a, z);
+ //boost::math::ntl::RR g = boost::math::tgamma(a);
+ boost::math::ntl::RR lg = boost::math::tgamma_lower(a, z);
+ boost::math::ntl::RR ug = boost::math::tgamma(a, z);
+ boost::math::ntl::RR rlg = boost::math::gamma_p(a, z);
+ boost::math::ntl::RR rug = boost::math::gamma_q(a, z);
 
       return std::tr1::make_tuple(z, ug, rug, lg, rlg);
    }
@@ -86,10 +86,10 @@
 
 struct gamma_inverse_generator
 {
- std::tr1::tuple<NTL::RR, NTL::RR> operator()(const NTL::RR a, const NTL::RR p)
+ std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR> operator()(const boost::math::ntl::RR a, const boost::math::ntl::RR p)
    {
- NTL::RR x1 = boost::math::gamma_p_inv(a, p);
- NTL::RR x2 = boost::math::gamma_q_inv(a, p);
+ boost::math::ntl::RR x1 = boost::math::gamma_p_inv(a, p);
+ boost::math::ntl::RR x2 = boost::math::gamma_q_inv(a, p);
       std::cout << "Inverse for " << a << " " << p << std::endl;
       return std::tr1::make_tuple(x1, x2);
    }
@@ -97,10 +97,10 @@
 
 struct gamma_inverse_generator_a
 {
- std::tr1::tuple<NTL::RR, NTL::RR> operator()(const NTL::RR x, const NTL::RR p)
+ std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR> operator()(const boost::math::ntl::RR x, const boost::math::ntl::RR p)
    {
- NTL::RR x1 = boost::math::gamma_p_inva(x, p);
- NTL::RR x2 = boost::math::gamma_q_inva(x, p);
+ boost::math::ntl::RR x1 = boost::math::gamma_p_inva(x, p);
+ boost::math::ntl::RR x2 = boost::math::gamma_q_inva(x, p);
       std::cout << "Inverse for " << x << " " << p << std::endl;
       return std::tr1::make_tuple(x1, x2);
    }
@@ -109,14 +109,14 @@
 
 int test_main(int argc, char*argv [])
 {
- NTL::RR::SetPrecision(1000);
- NTL::RR::SetOutputPrecision(100);
+ boost::math::ntl::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(100);
 
    bool cont;
    std::string line;
 
- parameter_info<NTL::RR> arg1, arg2;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1, arg2;
+ test_data<boost::math::ntl::RR> data;
 
    if((argc >= 2) && (std::strcmp(argv[1], "-inverse") == 0))
    {
@@ -152,7 +152,7 @@
    }
    else
    {
- arg2 = make_periodic_param(NTL::RR(1), NTL::RR(8), 7);
+ arg2 = make_periodic_param(boost::math::ntl::RR(1), boost::math::ntl::RR(8), 7);
       arg2.type |= boost::math::tools::dummy_param;
 
       std::cout << "Welcome.\n"

Modified: sandbox/math_toolkit/libs/math/tools/igamma_temme_large_coef.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/igamma_temme_large_coef.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/igamma_temme_large_coef.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -3,7 +3,7 @@
 // Boost Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/math/special_functions/log1p.hpp>
 #include <boost/math/special_functions/erf.hpp>
 #include <boost/math/constants/constants.hpp>
@@ -54,15 +54,15 @@
    return result;
 }
 
-RR gamma(unsigned k)
+boost::math::ntl::RR gamma(unsigned k)
 {
- static map<unsigned, RR> data;
+ static map<unsigned, boost::math::ntl::RR> data;
 
- map<unsigned, RR>::const_iterator pos = data.find(k);
+ map<unsigned, boost::math::ntl::RR>::const_iterator pos = data.find(k);
    if(pos != data.end())
       return (*pos).second;
 
- RR result = (k&1) ? -1 : 1;
+ boost::math::ntl::RR result = (k&1) ? -1 : 1;
 
    for(unsigned i = 1; i <= (2 * k + 1); i += 2)
       result *= i;
@@ -71,16 +71,16 @@
    return result;
 }
 
-RR Coeff(unsigned n, unsigned k)
+boost::math::ntl::RR Coeff(unsigned n, unsigned k)
 {
- map<unsigned, map<unsigned, RR> > data;
+ map<unsigned, map<unsigned, boost::math::ntl::RR> > data;
    if(data.empty())
- data[0][0] = RR(-1) / 3;
+ data[0][0] = boost::math::ntl::RR(-1) / 3;
 
- map<unsigned, map<unsigned, RR> >::const_iterator p1 = data.find(n);
+ map<unsigned, map<unsigned, boost::math::ntl::RR> >::const_iterator p1 = data.find(n);
    if(p1 != data.end())
    {
- map<unsigned, RR>::const_iterator p2 = p1->second.find(k);
+ map<unsigned, boost::math::ntl::RR>::const_iterator p2 = p1->second.find(k);
       if(p2 != p1->second.end())
       {
          return p2->second;
@@ -93,12 +93,12 @@
    if(k == 0)
    {
       // special case:
- RR result = (n+2) * alpha(n+2);
+ boost::math::ntl::RR result = (n+2) * alpha(n+2);
       data[n][k] = result;
       return result;
    }
    // general case:
- RR result = gamma(k) * Coeff(n, 0) + (n+2) * Coeff(n+2, k-1);
+ boost::math::ntl::RR result = gamma(k) * Coeff(n, 0) + (n+2) * Coeff(n+2, k-1);
    data[n][k] = result;
    return result;
 }

Modified: sandbox/math_toolkit/libs/math/tools/laguerre_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/laguerre_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/laguerre_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -1,5 +1,5 @@
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/math/tools/test_data.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/laguerre.hpp>
@@ -34,11 +34,11 @@
 {
    using namespace boost::math::tools;
 
- NTL::RR::SetOutputPrecision(50);
- NTL::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(50);
+ boost::math::ntl::RR::SetPrecision(1000);
 
- parameter_info<NTL::RR> arg1, arg2, arg3;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1, arg2, arg3;
+ test_data<boost::math::ntl::RR> data;
 
    bool cont;
    std::string line;
@@ -56,7 +56,7 @@
          arg1.type |= dummy_param;
          arg2.type |= dummy_param;
 
- data.insert(&laguerre2_data<NTL::RR>, arg1, arg2);
+ data.insert(&laguerre2_data<boost::math::ntl::RR>, arg1, arg2);
 
          std::cout << "Any more data [y/n]?";
          std::getline(std::cin, line);
@@ -77,7 +77,7 @@
          arg2.type |= dummy_param;
          arg3.type |= dummy_param;
 
- data.insert(&laguerre3_data<NTL::RR>, arg1, arg2, arg3);
+ data.insert(&laguerre3_data<boost::math::ntl::RR>, arg1, arg2, arg3);
 
          std::cout << "Any more data [y/n]?";
          std::getline(std::cin, line);

Modified: sandbox/math_toolkit/libs/math/tools/lanczos_generator.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/lanczos_generator.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/lanczos_generator.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -3,7 +3,7 @@
 // Boost Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/math/constants/constants.hpp>
 #include <boost/math/tools/precision.hpp>
 #include <boost/math/tools/test.hpp>
@@ -3635,14 +3635,14 @@
 //
 // A bunch of helper functions used for calculating the coefficients:
 //
-NTL::RR factorial(unsigned n)
+boost::math::ntl::RR factorial(unsigned n)
 {
- static boost::array<boost::array<NTL::RR, 1>, 201> result;
+ static boost::array<boost::array<boost::math::ntl::RR, 1>, 201> result;
    static bool init = false;
    if(!init)
    {
       unsigned k = 1;
- NTL::RR fact = 1;
+ boost::math::ntl::RR fact = 1;
       do{
          result[k-1][0] = fact;
          fact *= k++;
@@ -3655,7 +3655,7 @@
       return result[n][0];
 
    unsigned i = (unsigned)result.size()-1;
- NTL::RR r = result[i][0];
+ boost::math::ntl::RR r = result[i][0];
    while(i < n)
       r *= ++i;
    return r;
@@ -3773,7 +3773,7 @@
       r /= factorial(i);
       r *= exp(double(i) + g + 0.5);
       r /= ldexp(1.0, (2*i)-1);
- r /= pow(g + i + 0.5, i);
+ r /= pow(g + i + 0.5, (long)i);
       r /= sqrt(g + i + 0.5);
       result(i, 0) = r;
    }
@@ -4226,7 +4226,7 @@
 //
 // Print out the test values:
 //
-void print_test_values(const std::vector<std::vector<NTL::RR> >& v, const char* name, int offset = 1)
+void print_test_values(const std::vector<std::vector<boost::math::ntl::RR> >& v, const char* name, int offset = 1)
 {
    std::cout << "#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))\n";
    std::cout <<
@@ -4240,9 +4240,9 @@
 //
 // Get the error for a specific approximation, and print out it's code:
 //
-void calculate_lanczos_spot(int n, NTL::RR r, const char* suffix = "")
+void calculate_lanczos_spot(int n, boost::math::ntl::RR r, const char* suffix = "")
 {
- lanczos_info<NTL::RR> info = generate_lanczos(n, r);
+ lanczos_info<boost::math::ntl::RR> info = generate_lanczos(n, r);
    // note error is calculated at high precision:
    info.err = get_max_error(info, r);
    print_code(info, suffix);
@@ -4255,14 +4255,14 @@
 {
    using namespace std;
 
- lanczos_info<NTL::RR> best;
+ lanczos_info<boost::math::ntl::RR> best;
    best.err = 100; // best case had better be better than this!
    for(int i = 0; i < sizeof(sweet_spots)/sizeof(sweet_spots[0]); ++i)
    {
       if((sweet_spots[i].err < eps*10) && (sweet_spots[i].N < max_scan))
       {
- lanczos_info<NTL::RR> info = generate_lanczos(sweet_spots[i].N, NTL::RR(sweet_spots[i].g));
- NTL::RR err = get_max_error(info, eps);
+ lanczos_info<boost::math::ntl::RR> info = generate_lanczos(sweet_spots[i].N, boost::math::ntl::RR(sweet_spots[i].g));
+ boost::math::ntl::RR err = get_max_error(info, eps);
          if(err/eps < 1000)
          {
             std::cout << sweet_spots[i].N << " " << sweet_spots[i].g << " " << err/eps << std::endl;
@@ -4310,8 +4310,8 @@
          test_data = true;
    }
 
- NTL::RR::SetPrecision(1000);
- NTL::RR::SetOutputPrecision(40);
+ boost::math::ntl::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(40);
 
    if(spots)
    {
@@ -4327,7 +4327,7 @@
       calculate_lanczos_spot(6, 1.428456135094165802001953125);
       calculate_lanczos_spot(13, 6.024680040776729583740234375);
       calculate_lanczos_spot(17, 12.2252227365970611572265625);
- NTL::RR::SetOutputPrecision(90);
+ boost::math::ntl::RR::SetOutputPrecision(90);
       calculate_lanczos_spot(24, 20.3209821879863739013671875);
    }
    if(test_float)
@@ -4345,21 +4345,21 @@
    }
    if(test_quad)
    {
- find_best_lanczos("quad_float", pow(NTL::quad_float(2), NTL::quad_float(-105)));
+ //find_best_lanczos("quad_float", pow(NTL::quad_float(2), NTL::quad_float(-105)));
    }
    if(test_data)
    {
       std::cout << "Test Data follows:\n\n";
 
- NTL::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetPrecision(1000);
       
- std::vector<std::vector<NTL::RR> > const & tests = get_test_data<NTL::RR>();
+ std::vector<std::vector<boost::math::ntl::RR> > const & tests = get_test_data<boost::math::ntl::RR>();
       print_test_values(tests, "factorials");
- print_test_values(get_test_data_near_1<NTL::RR>(), "near_1", 0);
- print_test_values(get_test_data_near_2<NTL::RR>(), "near_2", 0);
- print_test_values(get_test_data_near_x<NTL::RR>(NTL::RR(0)), "near_0", 0);
- print_test_values(get_test_data_near_x<NTL::RR>(NTL::RR(-10)), "near_m10", 0);
- print_test_values(get_test_data_near_x<NTL::RR>(NTL::RR(-55)), "near_m55", 0);
+ print_test_values(get_test_data_near_1<boost::math::ntl::RR>(), "near_1", 0);
+ print_test_values(get_test_data_near_2<boost::math::ntl::RR>(), "near_2", 0);
+ print_test_values(get_test_data_near_x<boost::math::ntl::RR>(boost::math::ntl::RR(0)), "near_0", 0);
+ print_test_values(get_test_data_near_x<boost::math::ntl::RR>(boost::math::ntl::RR(-10)), "near_m10", 0);
+ print_test_values(get_test_data_near_x<boost::math::ntl::RR>(boost::math::ntl::RR(-55)), "near_m55", 0);
    }
    return 0;
 }

Modified: sandbox/math_toolkit/libs/math/tools/legendre_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/legendre_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/legendre_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -1,5 +1,5 @@
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/math/tools/test_data.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/legendre.hpp>
@@ -37,11 +37,11 @@
 {
    using namespace boost::math::tools;
 
- NTL::RR::SetOutputPrecision(50);
- NTL::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(50);
+ boost::math::ntl::RR::SetPrecision(1000);
 
- parameter_info<NTL::RR> arg1, arg2;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1, arg2;
+ test_data<boost::math::ntl::RR> data;
 
    bool cont;
    std::string line;
@@ -59,7 +59,7 @@
          arg1.type |= dummy_param;
          arg2.type |= dummy_param;
 
- data.insert(&legendre_p_data<NTL::RR>, arg1, arg2);
+ data.insert(&legendre_p_data<boost::math::ntl::RR>, arg1, arg2);
 
          std::cout << "Any more data [y/n]?";
          std::getline(std::cin, line);
@@ -77,7 +77,7 @@
          arg1.type |= dummy_param;
          arg2.type |= dummy_param;
 
- data.insert(&assoc_legendre_p_data<NTL::RR>, arg1, arg2);
+ data.insert(&assoc_legendre_p_data<boost::math::ntl::RR>, arg1, arg2);
 
          std::cout << "Any more data [y/n]?";
          std::getline(std::cin, line);

Modified: sandbox/math_toolkit/libs/math/tools/log1p_expm1_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/log1p_expm1_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/log1p_expm1_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -3,7 +3,7 @@
 // Boost Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <fstream>
 
 #include <boost/math/tools/test_data.hpp>
@@ -15,7 +15,7 @@
 
 struct data_generator
 {
- std::tr1::tuple<NTL::RR, NTL::RR> operator()(NTL::RR z)
+ std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR> operator()(boost::math::ntl::RR z)
    {
       return std::tr1::make_tuple(boost::math::log1p(z), boost::math::expm1(z));
    }
@@ -23,11 +23,11 @@
 
 int main(int argc, char* argv[])
 {
- NTL::RR::SetPrecision(1000);
- NTL::RR::SetOutputPrecision(40);
+ boost::math::ntl::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(40);
 
- parameter_info<NTL::RR> arg1;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1;
+ test_data<boost::math::ntl::RR> data;
 
    std::cout << "Welcome.\n"
       "This program will generate spot tests for the log1p and expm1 functions:\n\n";

Modified: sandbox/math_toolkit/libs/math/tools/ntl_rr_digamma.hpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/ntl_rr_digamma.hpp (original)
+++ sandbox/math_toolkit/libs/math/tools/ntl_rr_digamma.hpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -6,271 +6,270 @@
 #ifndef BOOST_MATH_NTL_DIGAMMA
 #define BOOST_MATH_NTL_DIGAMMA
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/math/tools/rational.hpp>
-#include <boost/math/tools/evaluation_type.hpp>
-#include <boost/math/tools/error_handling.hpp>
+#include <boost/math/policies/error_handling.hpp>
 #include <boost/math/constants/constants.hpp>
 
 namespace boost{ namespace math{
 
-NTL::RR digamma_imp(NTL::RR x)
+boost::math::ntl::RR digamma_imp(boost::math::ntl::RR x)
 {
- static const NTL::RR P[61] = {
- boost::lexical_cast<NTL::RR>("0.6660133691143982067148122682345055274952e81"),
- boost::lexical_cast<NTL::RR>("0.6365271516829242456324234577164675383137e81"),
- boost::lexical_cast<NTL::RR>("0.2991038873096202943405966144203628966976e81"),
- boost::lexical_cast<NTL::RR>("0.9211116495503170498076013367421231351115e80"),
- boost::lexical_cast<NTL::RR>("0.2090792764676090716286400360584443891749e80"),
- boost::lexical_cast<NTL::RR>("0.3730037777359591428226035156377978092809e79"),
- boost::lexical_cast<NTL::RR>("0.5446396536956682043376492370432031543834e78"),
- boost::lexical_cast<NTL::RR>("0.6692523966335177847425047827449069256345e77"),
- boost::lexical_cast<NTL::RR>("0.7062543624100864681625612653756619116848e76"),
- boost::lexical_cast<NTL::RR>("0.6499914905966283735005256964443226879158e75"),
- boost::lexical_cast<NTL::RR>("0.5280364564853225211197557708655426736091e74"),
- boost::lexical_cast<NTL::RR>("0.3823205608981176913075543599005095206953e73"),
- boost::lexical_cast<NTL::RR>("0.2486733714214237704739129972671154532415e72"),
- boost::lexical_cast<NTL::RR>("0.1462562139602039577983434547171318011675e71"),
- boost::lexical_cast<NTL::RR>("0.7821169065036815012381267259559910324285e69"),
- boost::lexical_cast<NTL::RR>("0.3820552182348155468636157988764435365078e68"),
- boost::lexical_cast<NTL::RR>("0.1711618296983598244658239925535632505062e67"),
- boost::lexical_cast<NTL::RR>("0.7056661618357643731419080738521475204245e65"),
- boost::lexical_cast<NTL::RR>("0.2685246896473614017356264531791459936036e64"),
- boost::lexical_cast<NTL::RR>("0.9455168125599643085283071944864977592391e62"),
- boost::lexical_cast<NTL::RR>("0.3087541626972538362237309145177486236219e61"),
- boost::lexical_cast<NTL::RR>("0.9367928873352980208052601301625005737407e59"),
- boost::lexical_cast<NTL::RR>("0.2645306130689794942883818547314327466007e58"),
- boost::lexical_cast<NTL::RR>("0.6961815141171454309161007351079576190079e56"),
- boost::lexical_cast<NTL::RR>("0.1709637824471794552313802669803885946843e55"),
- boost::lexical_cast<NTL::RR>("0.3921553258481531526663112728778759311158e53"),
- boost::lexical_cast<NTL::RR>("0.8409006354449988687714450897575728228696e51"),
- boost::lexical_cast<NTL::RR>("0.1686755204461325935742097669030363344927e50"),
- boost::lexical_cast<NTL::RR>("0.3166653542877070999007425197729038754254e48"),
- boost::lexical_cast<NTL::RR>("0.5566029092358215049069560272835654229637e46"),
- boost::lexical_cast<NTL::RR>("0.9161766287916328133080586672953875116242e44"),
- boost::lexical_cast<NTL::RR>("1412317772330871298317974693514430627922000"),
- boost::lexical_cast<NTL::RR>("20387991986727877473732570146112459874790"),
- boost::lexical_cast<NTL::RR>("275557928713904105182512535678580359839.3"),
- boost::lexical_cast<NTL::RR>("3485719851040516559072031256589598330.723"),
- boost::lexical_cast<NTL::RR>("41247046743564028399938106707656877.40859"),
- boost::lexical_cast<NTL::RR>("456274078125709314602601667471879.0147312"),
- boost::lexical_cast<NTL::RR>("4714450683242899367025707077155.310613012"),
- boost::lexical_cast<NTL::RR>("45453933537925041680009544258.75073849996"),
- boost::lexical_cast<NTL::RR>("408437900487067278846361972.302331241052"),
- boost::lexical_cast<NTL::RR>("3415719344386166273085838.705771571751035"),
- boost::lexical_cast<NTL::RR>("26541502879185876562320.93134691487351145"),
- boost::lexical_cast<NTL::RR>("191261415065918713661.1571433274648417668"),
- boost::lexical_cast<NTL::RR>("1275349770108718421.645275944284937551702"),
- boost::lexical_cast<NTL::RR>("7849171120971773.318910987434906905704272"),
- boost::lexical_cast<NTL::RR>("44455946386549.80866460312682983576538056"),
- boost::lexical_cast<NTL::RR>("230920362395.3198137186361608905136598046"),
- boost::lexical_cast<NTL::RR>("1095700096.240863858624279930600654130254"),
- boost::lexical_cast<NTL::RR>("4727085.467506050153744334085516289728134"),
- boost::lexical_cast<NTL::RR>("18440.75118859447173303252421991479005424"),
- boost::lexical_cast<NTL::RR>("64.62515887799460295677071749181651317052"),
- boost::lexical_cast<NTL::RR>("0.201851568864688406206528472883512147547"),
- boost::lexical_cast<NTL::RR>("0.0005565091674187978029138500039504078098143"),
- boost::lexical_cast<NTL::RR>("0.1338097668312907986354698683493366559613e-5"),
- boost::lexical_cast<NTL::RR>("0.276308225077464312820179030238305271638e-8"),
- boost::lexical_cast<NTL::RR>("0.4801582970473168520375942100071070575043e-11"),
- boost::lexical_cast<NTL::RR>("0.6829184144212920949740376186058541800175e-14"),
- boost::lexical_cast<NTL::RR>("0.7634080076358511276617829524639455399182e-17"),
- boost::lexical_cast<NTL::RR>("0.6290035083727140966418512608156646142409e-20"),
- boost::lexical_cast<NTL::RR>("0.339652245667538733044036638506893821352e-23"),
- boost::lexical_cast<NTL::RR>("0.9017518064256388530773585529891677854909e-27")
+ static const boost::math::ntl::RR P[61] = {
+ boost::lexical_cast<boost::math::ntl::RR>("0.6660133691143982067148122682345055274952e81"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.6365271516829242456324234577164675383137e81"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.2991038873096202943405966144203628966976e81"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.9211116495503170498076013367421231351115e80"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.2090792764676090716286400360584443891749e80"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.3730037777359591428226035156377978092809e79"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.5446396536956682043376492370432031543834e78"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.6692523966335177847425047827449069256345e77"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.7062543624100864681625612653756619116848e76"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.6499914905966283735005256964443226879158e75"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.5280364564853225211197557708655426736091e74"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.3823205608981176913075543599005095206953e73"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.2486733714214237704739129972671154532415e72"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1462562139602039577983434547171318011675e71"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.7821169065036815012381267259559910324285e69"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.3820552182348155468636157988764435365078e68"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1711618296983598244658239925535632505062e67"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.7056661618357643731419080738521475204245e65"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.2685246896473614017356264531791459936036e64"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.9455168125599643085283071944864977592391e62"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.3087541626972538362237309145177486236219e61"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.9367928873352980208052601301625005737407e59"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.2645306130689794942883818547314327466007e58"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.6961815141171454309161007351079576190079e56"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1709637824471794552313802669803885946843e55"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.3921553258481531526663112728778759311158e53"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.8409006354449988687714450897575728228696e51"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1686755204461325935742097669030363344927e50"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.3166653542877070999007425197729038754254e48"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.5566029092358215049069560272835654229637e46"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.9161766287916328133080586672953875116242e44"),
+ boost::lexical_cast<boost::math::ntl::RR>("1412317772330871298317974693514430627922000"),
+ boost::lexical_cast<boost::math::ntl::RR>("20387991986727877473732570146112459874790"),
+ boost::lexical_cast<boost::math::ntl::RR>("275557928713904105182512535678580359839.3"),
+ boost::lexical_cast<boost::math::ntl::RR>("3485719851040516559072031256589598330.723"),
+ boost::lexical_cast<boost::math::ntl::RR>("41247046743564028399938106707656877.40859"),
+ boost::lexical_cast<boost::math::ntl::RR>("456274078125709314602601667471879.0147312"),
+ boost::lexical_cast<boost::math::ntl::RR>("4714450683242899367025707077155.310613012"),
+ boost::lexical_cast<boost::math::ntl::RR>("45453933537925041680009544258.75073849996"),
+ boost::lexical_cast<boost::math::ntl::RR>("408437900487067278846361972.302331241052"),
+ boost::lexical_cast<boost::math::ntl::RR>("3415719344386166273085838.705771571751035"),
+ boost::lexical_cast<boost::math::ntl::RR>("26541502879185876562320.93134691487351145"),
+ boost::lexical_cast<boost::math::ntl::RR>("191261415065918713661.1571433274648417668"),
+ boost::lexical_cast<boost::math::ntl::RR>("1275349770108718421.645275944284937551702"),
+ boost::lexical_cast<boost::math::ntl::RR>("7849171120971773.318910987434906905704272"),
+ boost::lexical_cast<boost::math::ntl::RR>("44455946386549.80866460312682983576538056"),
+ boost::lexical_cast<boost::math::ntl::RR>("230920362395.3198137186361608905136598046"),
+ boost::lexical_cast<boost::math::ntl::RR>("1095700096.240863858624279930600654130254"),
+ boost::lexical_cast<boost::math::ntl::RR>("4727085.467506050153744334085516289728134"),
+ boost::lexical_cast<boost::math::ntl::RR>("18440.75118859447173303252421991479005424"),
+ boost::lexical_cast<boost::math::ntl::RR>("64.62515887799460295677071749181651317052"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.201851568864688406206528472883512147547"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.0005565091674187978029138500039504078098143"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1338097668312907986354698683493366559613e-5"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.276308225077464312820179030238305271638e-8"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.4801582970473168520375942100071070575043e-11"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.6829184144212920949740376186058541800175e-14"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.7634080076358511276617829524639455399182e-17"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.6290035083727140966418512608156646142409e-20"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.339652245667538733044036638506893821352e-23"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.9017518064256388530773585529891677854909e-27")
       };
- static const NTL::RR Q[61] = {
- boost::lexical_cast<NTL::RR>("0"),
- boost::lexical_cast<NTL::RR>("0.1386831185456898357379390197203894063459e81"),
- boost::lexical_cast<NTL::RR>("0.6467076379487574703291056110838151259438e81"),
- boost::lexical_cast<NTL::RR>("0.1394967823848615838336194279565285465161e82"),
- boost::lexical_cast<NTL::RR>("0.1872927317344192945218570366455046340458e82"),
- boost::lexical_cast<NTL::RR>("0.1772461045338946243584650759986310355937e82"),
- boost::lexical_cast<NTL::RR>("0.1267294892200258648315971144069595555118e82"),
- boost::lexical_cast<NTL::RR>("0.7157764838362416821508872117623058626589e81"),
- boost::lexical_cast<NTL::RR>("0.329447266909948668265277828268378274513e81"),
- boost::lexical_cast<NTL::RR>("0.1264376077317689779509250183194342571207e81"),
- boost::lexical_cast<NTL::RR>("0.4118230304191980787640446056583623228873e80"),
- boost::lexical_cast<NTL::RR>("0.1154393529762694616405952270558316515261e80"),
- boost::lexical_cast<NTL::RR>("0.281655612889423906125295485693696744275e79"),
- boost::lexical_cast<NTL::RR>("0.6037483524928743102724159846414025482077e78"),
- boost::lexical_cast<NTL::RR>("0.1145927995397835468123576831800276999614e78"),
- boost::lexical_cast<NTL::RR>("0.1938624296151985600348534009382865995154e77"),
- boost::lexical_cast<NTL::RR>("0.293980925856227626211879961219188406675e76"),
- boost::lexical_cast<NTL::RR>("0.4015574518216966910319562902099567437832e75"),
- boost::lexical_cast<NTL::RR>("0.4961475457509727343545565970423431880907e74"),
- boost::lexical_cast<NTL::RR>("0.5565482348278933960215521991000378896338e73"),
- boost::lexical_cast<NTL::RR>("0.5686112924615820754631098622770303094938e72"),
- boost::lexical_cast<NTL::RR>("0.5305988545844796293285410303747469932856e71"),
- boost::lexical_cast<NTL::RR>("0.4533363413802585060568537458067343491358e70"),
- boost::lexical_cast<NTL::RR>("0.3553932059473516064068322757331575565718e69"),
- boost::lexical_cast<NTL::RR>("0.2561198565218704414618802902533972354203e68"),
- boost::lexical_cast<NTL::RR>("0.1699519313292900324098102065697454295572e67"),
- boost::lexical_cast<NTL::RR>("0.1039830160862334505389615281373574959236e66"),
- boost::lexical_cast<NTL::RR>("0.5873082967977428281000961954715372504986e64"),
- boost::lexical_cast<NTL::RR>("0.3065255179030575882202133042549783442446e63"),
- boost::lexical_cast<NTL::RR>("0.1479494813481364701208655943688307245459e62"),
- boost::lexical_cast<NTL::RR>("0.6608150467921598615495180659808895663164e60"),
- boost::lexical_cast<NTL::RR>("0.2732535313770902021791888953487787496976e59"),
- boost::lexical_cast<NTL::RR>("0.1046402297662493314531194338414508049069e58"),
- boost::lexical_cast<NTL::RR>("0.3711375077192882936085049147920021549622e56"),
- boost::lexical_cast<NTL::RR>("0.1219154482883895482637944309702972234576e55"),
- boost::lexical_cast<NTL::RR>("0.3708359374149458741391374452286837880162e53"),
- boost::lexical_cast<NTL::RR>("0.1044095509971707189716913168889769471468e52"),
- boost::lexical_cast<NTL::RR>("0.271951506225063286130946773813524945052e50"),
- boost::lexical_cast<NTL::RR>("0.6548016291215163843464133978454065823866e48"),
- boost::lexical_cast<NTL::RR>("0.1456062447610542135403751730809295219344e47"),
- boost::lexical_cast<NTL::RR>("0.2986690175077969760978388356833006028929e45"),
- boost::lexical_cast<NTL::RR>("5643149706574013350061247429006443326844000"),
- boost::lexical_cast<NTL::RR>("98047545414467090421964387960743688053480"),
- boost::lexical_cast<NTL::RR>("1563378767746846395507385099301468978550"),
- boost::lexical_cast<NTL::RR>("22823360528584500077862274918382796495"),
- boost::lexical_cast<NTL::RR>("304215527004115213046601295970388750"),
- boost::lexical_cast<NTL::RR>("3690289075895685793844344966820325"),
- boost::lexical_cast<NTL::RR>("40584512015702371433911456606050"),
- boost::lexical_cast<NTL::RR>("402834190897282802772754873905"),
- boost::lexical_cast<NTL::RR>("3589522158493606918146495750"),
- boost::lexical_cast<NTL::RR>("28530557707503483723634725"),
- boost::lexical_cast<NTL::RR>("200714561335055753000730"),
- boost::lexical_cast<NTL::RR>("1237953783437761888641"),
- boost::lexical_cast<NTL::RR>("6614698701445762950"),
- boost::lexical_cast<NTL::RR>("30155495647727505"),
- boost::lexical_cast<NTL::RR>("114953256021450"),
- boost::lexical_cast<NTL::RR>("356398020013"),
- boost::lexical_cast<NTL::RR>("863113950"),
- boost::lexical_cast<NTL::RR>("1531345"),
- boost::lexical_cast<NTL::RR>("1770"),
- boost::lexical_cast<NTL::RR>("1")
+ static const boost::math::ntl::RR Q[61] = {
+ boost::lexical_cast<boost::math::ntl::RR>("0"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1386831185456898357379390197203894063459e81"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.6467076379487574703291056110838151259438e81"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1394967823848615838336194279565285465161e82"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1872927317344192945218570366455046340458e82"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1772461045338946243584650759986310355937e82"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1267294892200258648315971144069595555118e82"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.7157764838362416821508872117623058626589e81"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.329447266909948668265277828268378274513e81"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1264376077317689779509250183194342571207e81"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.4118230304191980787640446056583623228873e80"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1154393529762694616405952270558316515261e80"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.281655612889423906125295485693696744275e79"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.6037483524928743102724159846414025482077e78"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1145927995397835468123576831800276999614e78"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1938624296151985600348534009382865995154e77"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.293980925856227626211879961219188406675e76"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.4015574518216966910319562902099567437832e75"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.4961475457509727343545565970423431880907e74"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.5565482348278933960215521991000378896338e73"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.5686112924615820754631098622770303094938e72"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.5305988545844796293285410303747469932856e71"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.4533363413802585060568537458067343491358e70"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.3553932059473516064068322757331575565718e69"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.2561198565218704414618802902533972354203e68"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1699519313292900324098102065697454295572e67"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1039830160862334505389615281373574959236e66"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.5873082967977428281000961954715372504986e64"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.3065255179030575882202133042549783442446e63"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1479494813481364701208655943688307245459e62"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.6608150467921598615495180659808895663164e60"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.2732535313770902021791888953487787496976e59"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1046402297662493314531194338414508049069e58"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.3711375077192882936085049147920021549622e56"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1219154482883895482637944309702972234576e55"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.3708359374149458741391374452286837880162e53"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1044095509971707189716913168889769471468e52"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.271951506225063286130946773813524945052e50"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.6548016291215163843464133978454065823866e48"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.1456062447610542135403751730809295219344e47"),
+ boost::lexical_cast<boost::math::ntl::RR>("0.2986690175077969760978388356833006028929e45"),
+ boost::lexical_cast<boost::math::ntl::RR>("5643149706574013350061247429006443326844000"),
+ boost::lexical_cast<boost::math::ntl::RR>("98047545414467090421964387960743688053480"),
+ boost::lexical_cast<boost::math::ntl::RR>("1563378767746846395507385099301468978550"),
+ boost::lexical_cast<boost::math::ntl::RR>("22823360528584500077862274918382796495"),
+ boost::lexical_cast<boost::math::ntl::RR>("304215527004115213046601295970388750"),
+ boost::lexical_cast<boost::math::ntl::RR>("3690289075895685793844344966820325"),
+ boost::lexical_cast<boost::math::ntl::RR>("40584512015702371433911456606050"),
+ boost::lexical_cast<boost::math::ntl::RR>("402834190897282802772754873905"),
+ boost::lexical_cast<boost::math::ntl::RR>("3589522158493606918146495750"),
+ boost::lexical_cast<boost::math::ntl::RR>("28530557707503483723634725"),
+ boost::lexical_cast<boost::math::ntl::RR>("200714561335055753000730"),
+ boost::lexical_cast<boost::math::ntl::RR>("1237953783437761888641"),
+ boost::lexical_cast<boost::math::ntl::RR>("6614698701445762950"),
+ boost::lexical_cast<boost::math::ntl::RR>("30155495647727505"),
+ boost::lexical_cast<boost::math::ntl::RR>("114953256021450"),
+ boost::lexical_cast<boost::math::ntl::RR>("356398020013"),
+ boost::lexical_cast<boost::math::ntl::RR>("863113950"),
+ boost::lexical_cast<boost::math::ntl::RR>("1531345"),
+ boost::lexical_cast<boost::math::ntl::RR>("1770"),
+ boost::lexical_cast<boost::math::ntl::RR>("1")
       };
- static const NTL::RR PD[60] = {
- boost::lexical_cast<NTL::RR>("0.6365271516829242456324234577164675383137e81"),
- 2*boost::lexical_cast<NTL::RR>("0.2991038873096202943405966144203628966976e81"),
- 3*boost::lexical_cast<NTL::RR>("0.9211116495503170498076013367421231351115e80"),
- 4*boost::lexical_cast<NTL::RR>("0.2090792764676090716286400360584443891749e80"),
- 5*boost::lexical_cast<NTL::RR>("0.3730037777359591428226035156377978092809e79"),
- 6*boost::lexical_cast<NTL::RR>("0.5446396536956682043376492370432031543834e78"),
- 7*boost::lexical_cast<NTL::RR>("0.6692523966335177847425047827449069256345e77"),
- 8*boost::lexical_cast<NTL::RR>("0.7062543624100864681625612653756619116848e76"),
- 9*boost::lexical_cast<NTL::RR>("0.6499914905966283735005256964443226879158e75"),
- 10*boost::lexical_cast<NTL::RR>("0.5280364564853225211197557708655426736091e74"),
- 11*boost::lexical_cast<NTL::RR>("0.3823205608981176913075543599005095206953e73"),
- 12*boost::lexical_cast<NTL::RR>("0.2486733714214237704739129972671154532415e72"),
- 13*boost::lexical_cast<NTL::RR>("0.1462562139602039577983434547171318011675e71"),
- 14*boost::lexical_cast<NTL::RR>("0.7821169065036815012381267259559910324285e69"),
- 15*boost::lexical_cast<NTL::RR>("0.3820552182348155468636157988764435365078e68"),
- 16*boost::lexical_cast<NTL::RR>("0.1711618296983598244658239925535632505062e67"),
- 17*boost::lexical_cast<NTL::RR>("0.7056661618357643731419080738521475204245e65"),
- 18*boost::lexical_cast<NTL::RR>("0.2685246896473614017356264531791459936036e64"),
- 19*boost::lexical_cast<NTL::RR>("0.9455168125599643085283071944864977592391e62"),
- 20*boost::lexical_cast<NTL::RR>("0.3087541626972538362237309145177486236219e61"),
- 21*boost::lexical_cast<NTL::RR>("0.9367928873352980208052601301625005737407e59"),
- 22*boost::lexical_cast<NTL::RR>("0.2645306130689794942883818547314327466007e58"),
- 23*boost::lexical_cast<NTL::RR>("0.6961815141171454309161007351079576190079e56"),
- 24*boost::lexical_cast<NTL::RR>("0.1709637824471794552313802669803885946843e55"),
- 25*boost::lexical_cast<NTL::RR>("0.3921553258481531526663112728778759311158e53"),
- 26*boost::lexical_cast<NTL::RR>("0.8409006354449988687714450897575728228696e51"),
- 27*boost::lexical_cast<NTL::RR>("0.1686755204461325935742097669030363344927e50"),
- 28*boost::lexical_cast<NTL::RR>("0.3166653542877070999007425197729038754254e48"),
- 29*boost::lexical_cast<NTL::RR>("0.5566029092358215049069560272835654229637e46"),
- 30*boost::lexical_cast<NTL::RR>("0.9161766287916328133080586672953875116242e44"),
- 31*boost::lexical_cast<NTL::RR>("1412317772330871298317974693514430627922000"),
- 32*boost::lexical_cast<NTL::RR>("20387991986727877473732570146112459874790"),
- 33*boost::lexical_cast<NTL::RR>("275557928713904105182512535678580359839.3"),
- 34*boost::lexical_cast<NTL::RR>("3485719851040516559072031256589598330.723"),
- 35*boost::lexical_cast<NTL::RR>("41247046743564028399938106707656877.40859"),
- 36*boost::lexical_cast<NTL::RR>("456274078125709314602601667471879.0147312"),
- 37*boost::lexical_cast<NTL::RR>("4714450683242899367025707077155.310613012"),
- 38*boost::lexical_cast<NTL::RR>("45453933537925041680009544258.75073849996"),
- 39*boost::lexical_cast<NTL::RR>("408437900487067278846361972.302331241052"),
- 40*boost::lexical_cast<NTL::RR>("3415719344386166273085838.705771571751035"),
- 41*boost::lexical_cast<NTL::RR>("26541502879185876562320.93134691487351145"),
- 42*boost::lexical_cast<NTL::RR>("191261415065918713661.1571433274648417668"),
- 43*boost::lexical_cast<NTL::RR>("1275349770108718421.645275944284937551702"),
- 44*boost::lexical_cast<NTL::RR>("7849171120971773.318910987434906905704272"),
- 45*boost::lexical_cast<NTL::RR>("44455946386549.80866460312682983576538056"),
- 46*boost::lexical_cast<NTL::RR>("230920362395.3198137186361608905136598046"),
- 47*boost::lexical_cast<NTL::RR>("1095700096.240863858624279930600654130254"),
- 48*boost::lexical_cast<NTL::RR>("4727085.467506050153744334085516289728134"),
- 49*boost::lexical_cast<NTL::RR>("18440.75118859447173303252421991479005424"),
- 50*boost::lexical_cast<NTL::RR>("64.62515887799460295677071749181651317052"),
- 51*boost::lexical_cast<NTL::RR>("0.201851568864688406206528472883512147547"),
- 52*boost::lexical_cast<NTL::RR>("0.0005565091674187978029138500039504078098143"),
- 53*boost::lexical_cast<NTL::RR>("0.1338097668312907986354698683493366559613e-5"),
- 54*boost::lexical_cast<NTL::RR>("0.276308225077464312820179030238305271638e-8"),
- 55*boost::lexical_cast<NTL::RR>("0.4801582970473168520375942100071070575043e-11"),
- 56*boost::lexical_cast<NTL::RR>("0.6829184144212920949740376186058541800175e-14"),
- 57*boost::lexical_cast<NTL::RR>("0.7634080076358511276617829524639455399182e-17"),
- 58*boost::lexical_cast<NTL::RR>("0.6290035083727140966418512608156646142409e-20"),
- 59*boost::lexical_cast<NTL::RR>("0.339652245667538733044036638506893821352e-23"),
- 60*boost::lexical_cast<NTL::RR>("0.9017518064256388530773585529891677854909e-27")
+ static const boost::math::ntl::RR PD[60] = {
+ boost::lexical_cast<boost::math::ntl::RR>("0.6365271516829242456324234577164675383137e81"),
+ 2*boost::lexical_cast<boost::math::ntl::RR>("0.2991038873096202943405966144203628966976e81"),
+ 3*boost::lexical_cast<boost::math::ntl::RR>("0.9211116495503170498076013367421231351115e80"),
+ 4*boost::lexical_cast<boost::math::ntl::RR>("0.2090792764676090716286400360584443891749e80"),
+ 5*boost::lexical_cast<boost::math::ntl::RR>("0.3730037777359591428226035156377978092809e79"),
+ 6*boost::lexical_cast<boost::math::ntl::RR>("0.5446396536956682043376492370432031543834e78"),
+ 7*boost::lexical_cast<boost::math::ntl::RR>("0.6692523966335177847425047827449069256345e77"),
+ 8*boost::lexical_cast<boost::math::ntl::RR>("0.7062543624100864681625612653756619116848e76"),
+ 9*boost::lexical_cast<boost::math::ntl::RR>("0.6499914905966283735005256964443226879158e75"),
+ 10*boost::lexical_cast<boost::math::ntl::RR>("0.5280364564853225211197557708655426736091e74"),
+ 11*boost::lexical_cast<boost::math::ntl::RR>("0.3823205608981176913075543599005095206953e73"),
+ 12*boost::lexical_cast<boost::math::ntl::RR>("0.2486733714214237704739129972671154532415e72"),
+ 13*boost::lexical_cast<boost::math::ntl::RR>("0.1462562139602039577983434547171318011675e71"),
+ 14*boost::lexical_cast<boost::math::ntl::RR>("0.7821169065036815012381267259559910324285e69"),
+ 15*boost::lexical_cast<boost::math::ntl::RR>("0.3820552182348155468636157988764435365078e68"),
+ 16*boost::lexical_cast<boost::math::ntl::RR>("0.1711618296983598244658239925535632505062e67"),
+ 17*boost::lexical_cast<boost::math::ntl::RR>("0.7056661618357643731419080738521475204245e65"),
+ 18*boost::lexical_cast<boost::math::ntl::RR>("0.2685246896473614017356264531791459936036e64"),
+ 19*boost::lexical_cast<boost::math::ntl::RR>("0.9455168125599643085283071944864977592391e62"),
+ 20*boost::lexical_cast<boost::math::ntl::RR>("0.3087541626972538362237309145177486236219e61"),
+ 21*boost::lexical_cast<boost::math::ntl::RR>("0.9367928873352980208052601301625005737407e59"),
+ 22*boost::lexical_cast<boost::math::ntl::RR>("0.2645306130689794942883818547314327466007e58"),
+ 23*boost::lexical_cast<boost::math::ntl::RR>("0.6961815141171454309161007351079576190079e56"),
+ 24*boost::lexical_cast<boost::math::ntl::RR>("0.1709637824471794552313802669803885946843e55"),
+ 25*boost::lexical_cast<boost::math::ntl::RR>("0.3921553258481531526663112728778759311158e53"),
+ 26*boost::lexical_cast<boost::math::ntl::RR>("0.8409006354449988687714450897575728228696e51"),
+ 27*boost::lexical_cast<boost::math::ntl::RR>("0.1686755204461325935742097669030363344927e50"),
+ 28*boost::lexical_cast<boost::math::ntl::RR>("0.3166653542877070999007425197729038754254e48"),
+ 29*boost::lexical_cast<boost::math::ntl::RR>("0.5566029092358215049069560272835654229637e46"),
+ 30*boost::lexical_cast<boost::math::ntl::RR>("0.9161766287916328133080586672953875116242e44"),
+ 31*boost::lexical_cast<boost::math::ntl::RR>("1412317772330871298317974693514430627922000"),
+ 32*boost::lexical_cast<boost::math::ntl::RR>("20387991986727877473732570146112459874790"),
+ 33*boost::lexical_cast<boost::math::ntl::RR>("275557928713904105182512535678580359839.3"),
+ 34*boost::lexical_cast<boost::math::ntl::RR>("3485719851040516559072031256589598330.723"),
+ 35*boost::lexical_cast<boost::math::ntl::RR>("41247046743564028399938106707656877.40859"),
+ 36*boost::lexical_cast<boost::math::ntl::RR>("456274078125709314602601667471879.0147312"),
+ 37*boost::lexical_cast<boost::math::ntl::RR>("4714450683242899367025707077155.310613012"),
+ 38*boost::lexical_cast<boost::math::ntl::RR>("45453933537925041680009544258.75073849996"),
+ 39*boost::lexical_cast<boost::math::ntl::RR>("408437900487067278846361972.302331241052"),
+ 40*boost::lexical_cast<boost::math::ntl::RR>("3415719344386166273085838.705771571751035"),
+ 41*boost::lexical_cast<boost::math::ntl::RR>("26541502879185876562320.93134691487351145"),
+ 42*boost::lexical_cast<boost::math::ntl::RR>("191261415065918713661.1571433274648417668"),
+ 43*boost::lexical_cast<boost::math::ntl::RR>("1275349770108718421.645275944284937551702"),
+ 44*boost::lexical_cast<boost::math::ntl::RR>("7849171120971773.318910987434906905704272"),
+ 45*boost::lexical_cast<boost::math::ntl::RR>("44455946386549.80866460312682983576538056"),
+ 46*boost::lexical_cast<boost::math::ntl::RR>("230920362395.3198137186361608905136598046"),
+ 47*boost::lexical_cast<boost::math::ntl::RR>("1095700096.240863858624279930600654130254"),
+ 48*boost::lexical_cast<boost::math::ntl::RR>("4727085.467506050153744334085516289728134"),
+ 49*boost::lexical_cast<boost::math::ntl::RR>("18440.75118859447173303252421991479005424"),
+ 50*boost::lexical_cast<boost::math::ntl::RR>("64.62515887799460295677071749181651317052"),
+ 51*boost::lexical_cast<boost::math::ntl::RR>("0.201851568864688406206528472883512147547"),
+ 52*boost::lexical_cast<boost::math::ntl::RR>("0.0005565091674187978029138500039504078098143"),
+ 53*boost::lexical_cast<boost::math::ntl::RR>("0.1338097668312907986354698683493366559613e-5"),
+ 54*boost::lexical_cast<boost::math::ntl::RR>("0.276308225077464312820179030238305271638e-8"),
+ 55*boost::lexical_cast<boost::math::ntl::RR>("0.4801582970473168520375942100071070575043e-11"),
+ 56*boost::lexical_cast<boost::math::ntl::RR>("0.6829184144212920949740376186058541800175e-14"),
+ 57*boost::lexical_cast<boost::math::ntl::RR>("0.7634080076358511276617829524639455399182e-17"),
+ 58*boost::lexical_cast<boost::math::ntl::RR>("0.6290035083727140966418512608156646142409e-20"),
+ 59*boost::lexical_cast<boost::math::ntl::RR>("0.339652245667538733044036638506893821352e-23"),
+ 60*boost::lexical_cast<boost::math::ntl::RR>("0.9017518064256388530773585529891677854909e-27")
       };
- static const NTL::RR QD[60] = {
- boost::lexical_cast<NTL::RR>("0.1386831185456898357379390197203894063459e81"),
- 2*boost::lexical_cast<NTL::RR>("0.6467076379487574703291056110838151259438e81"),
- 3*boost::lexical_cast<NTL::RR>("0.1394967823848615838336194279565285465161e82"),
- 4*boost::lexical_cast<NTL::RR>("0.1872927317344192945218570366455046340458e82"),
- 5*boost::lexical_cast<NTL::RR>("0.1772461045338946243584650759986310355937e82"),
- 6*boost::lexical_cast<NTL::RR>("0.1267294892200258648315971144069595555118e82"),
- 7*boost::lexical_cast<NTL::RR>("0.7157764838362416821508872117623058626589e81"),
- 8*boost::lexical_cast<NTL::RR>("0.329447266909948668265277828268378274513e81"),
- 9*boost::lexical_cast<NTL::RR>("0.1264376077317689779509250183194342571207e81"),
- 10*boost::lexical_cast<NTL::RR>("0.4118230304191980787640446056583623228873e80"),
- 11*boost::lexical_cast<NTL::RR>("0.1154393529762694616405952270558316515261e80"),
- 12*boost::lexical_cast<NTL::RR>("0.281655612889423906125295485693696744275e79"),
- 13*boost::lexical_cast<NTL::RR>("0.6037483524928743102724159846414025482077e78"),
- 14*boost::lexical_cast<NTL::RR>("0.1145927995397835468123576831800276999614e78"),
- 15*boost::lexical_cast<NTL::RR>("0.1938624296151985600348534009382865995154e77"),
- 16*boost::lexical_cast<NTL::RR>("0.293980925856227626211879961219188406675e76"),
- 17*boost::lexical_cast<NTL::RR>("0.4015574518216966910319562902099567437832e75"),
- 18*boost::lexical_cast<NTL::RR>("0.4961475457509727343545565970423431880907e74"),
- 19*boost::lexical_cast<NTL::RR>("0.5565482348278933960215521991000378896338e73"),
- 20*boost::lexical_cast<NTL::RR>("0.5686112924615820754631098622770303094938e72"),
- 21*boost::lexical_cast<NTL::RR>("0.5305988545844796293285410303747469932856e71"),
- 22*boost::lexical_cast<NTL::RR>("0.4533363413802585060568537458067343491358e70"),
- 23*boost::lexical_cast<NTL::RR>("0.3553932059473516064068322757331575565718e69"),
- 24*boost::lexical_cast<NTL::RR>("0.2561198565218704414618802902533972354203e68"),
- 25*boost::lexical_cast<NTL::RR>("0.1699519313292900324098102065697454295572e67"),
- 26*boost::lexical_cast<NTL::RR>("0.1039830160862334505389615281373574959236e66"),
- 27*boost::lexical_cast<NTL::RR>("0.5873082967977428281000961954715372504986e64"),
- 28*boost::lexical_cast<NTL::RR>("0.3065255179030575882202133042549783442446e63"),
- 29*boost::lexical_cast<NTL::RR>("0.1479494813481364701208655943688307245459e62"),
- 30*boost::lexical_cast<NTL::RR>("0.6608150467921598615495180659808895663164e60"),
- 31*boost::lexical_cast<NTL::RR>("0.2732535313770902021791888953487787496976e59"),
- 32*boost::lexical_cast<NTL::RR>("0.1046402297662493314531194338414508049069e58"),
- 33*boost::lexical_cast<NTL::RR>("0.3711375077192882936085049147920021549622e56"),
- 34*boost::lexical_cast<NTL::RR>("0.1219154482883895482637944309702972234576e55"),
- 35*boost::lexical_cast<NTL::RR>("0.3708359374149458741391374452286837880162e53"),
- 36*boost::lexical_cast<NTL::RR>("0.1044095509971707189716913168889769471468e52"),
- 37*boost::lexical_cast<NTL::RR>("0.271951506225063286130946773813524945052e50"),
- 38*boost::lexical_cast<NTL::RR>("0.6548016291215163843464133978454065823866e48"),
- 39*boost::lexical_cast<NTL::RR>("0.1456062447610542135403751730809295219344e47"),
- 40*boost::lexical_cast<NTL::RR>("0.2986690175077969760978388356833006028929e45"),
- 41*boost::lexical_cast<NTL::RR>("5643149706574013350061247429006443326844000"),
- 42*boost::lexical_cast<NTL::RR>("98047545414467090421964387960743688053480"),
- 43*boost::lexical_cast<NTL::RR>("1563378767746846395507385099301468978550"),
- 44*boost::lexical_cast<NTL::RR>("22823360528584500077862274918382796495"),
- 45*boost::lexical_cast<NTL::RR>("304215527004115213046601295970388750"),
- 46*boost::lexical_cast<NTL::RR>("3690289075895685793844344966820325"),
- 47*boost::lexical_cast<NTL::RR>("40584512015702371433911456606050"),
- 48*boost::lexical_cast<NTL::RR>("402834190897282802772754873905"),
- 49*boost::lexical_cast<NTL::RR>("3589522158493606918146495750"),
- 50*boost::lexical_cast<NTL::RR>("28530557707503483723634725"),
- 51*boost::lexical_cast<NTL::RR>("200714561335055753000730"),
- 52*boost::lexical_cast<NTL::RR>("1237953783437761888641"),
- 53*boost::lexical_cast<NTL::RR>("6614698701445762950"),
- 54*boost::lexical_cast<NTL::RR>("30155495647727505"),
- 55*boost::lexical_cast<NTL::RR>("114953256021450"),
- 56*boost::lexical_cast<NTL::RR>("356398020013"),
- 57*boost::lexical_cast<NTL::RR>("863113950"),
- 58*boost::lexical_cast<NTL::RR>("1531345"),
- 59*boost::lexical_cast<NTL::RR>("1770"),
- 60*boost::lexical_cast<NTL::RR>("1")
+ static const boost::math::ntl::RR QD[60] = {
+ boost::lexical_cast<boost::math::ntl::RR>("0.1386831185456898357379390197203894063459e81"),
+ 2*boost::lexical_cast<boost::math::ntl::RR>("0.6467076379487574703291056110838151259438e81"),
+ 3*boost::lexical_cast<boost::math::ntl::RR>("0.1394967823848615838336194279565285465161e82"),
+ 4*boost::lexical_cast<boost::math::ntl::RR>("0.1872927317344192945218570366455046340458e82"),
+ 5*boost::lexical_cast<boost::math::ntl::RR>("0.1772461045338946243584650759986310355937e82"),
+ 6*boost::lexical_cast<boost::math::ntl::RR>("0.1267294892200258648315971144069595555118e82"),
+ 7*boost::lexical_cast<boost::math::ntl::RR>("0.7157764838362416821508872117623058626589e81"),
+ 8*boost::lexical_cast<boost::math::ntl::RR>("0.329447266909948668265277828268378274513e81"),
+ 9*boost::lexical_cast<boost::math::ntl::RR>("0.1264376077317689779509250183194342571207e81"),
+ 10*boost::lexical_cast<boost::math::ntl::RR>("0.4118230304191980787640446056583623228873e80"),
+ 11*boost::lexical_cast<boost::math::ntl::RR>("0.1154393529762694616405952270558316515261e80"),
+ 12*boost::lexical_cast<boost::math::ntl::RR>("0.281655612889423906125295485693696744275e79"),
+ 13*boost::lexical_cast<boost::math::ntl::RR>("0.6037483524928743102724159846414025482077e78"),
+ 14*boost::lexical_cast<boost::math::ntl::RR>("0.1145927995397835468123576831800276999614e78"),
+ 15*boost::lexical_cast<boost::math::ntl::RR>("0.1938624296151985600348534009382865995154e77"),
+ 16*boost::lexical_cast<boost::math::ntl::RR>("0.293980925856227626211879961219188406675e76"),
+ 17*boost::lexical_cast<boost::math::ntl::RR>("0.4015574518216966910319562902099567437832e75"),
+ 18*boost::lexical_cast<boost::math::ntl::RR>("0.4961475457509727343545565970423431880907e74"),
+ 19*boost::lexical_cast<boost::math::ntl::RR>("0.5565482348278933960215521991000378896338e73"),
+ 20*boost::lexical_cast<boost::math::ntl::RR>("0.5686112924615820754631098622770303094938e72"),
+ 21*boost::lexical_cast<boost::math::ntl::RR>("0.5305988545844796293285410303747469932856e71"),
+ 22*boost::lexical_cast<boost::math::ntl::RR>("0.4533363413802585060568537458067343491358e70"),
+ 23*boost::lexical_cast<boost::math::ntl::RR>("0.3553932059473516064068322757331575565718e69"),
+ 24*boost::lexical_cast<boost::math::ntl::RR>("0.2561198565218704414618802902533972354203e68"),
+ 25*boost::lexical_cast<boost::math::ntl::RR>("0.1699519313292900324098102065697454295572e67"),
+ 26*boost::lexical_cast<boost::math::ntl::RR>("0.1039830160862334505389615281373574959236e66"),
+ 27*boost::lexical_cast<boost::math::ntl::RR>("0.5873082967977428281000961954715372504986e64"),
+ 28*boost::lexical_cast<boost::math::ntl::RR>("0.3065255179030575882202133042549783442446e63"),
+ 29*boost::lexical_cast<boost::math::ntl::RR>("0.1479494813481364701208655943688307245459e62"),
+ 30*boost::lexical_cast<boost::math::ntl::RR>("0.6608150467921598615495180659808895663164e60"),
+ 31*boost::lexical_cast<boost::math::ntl::RR>("0.2732535313770902021791888953487787496976e59"),
+ 32*boost::lexical_cast<boost::math::ntl::RR>("0.1046402297662493314531194338414508049069e58"),
+ 33*boost::lexical_cast<boost::math::ntl::RR>("0.3711375077192882936085049147920021549622e56"),
+ 34*boost::lexical_cast<boost::math::ntl::RR>("0.1219154482883895482637944309702972234576e55"),
+ 35*boost::lexical_cast<boost::math::ntl::RR>("0.3708359374149458741391374452286837880162e53"),
+ 36*boost::lexical_cast<boost::math::ntl::RR>("0.1044095509971707189716913168889769471468e52"),
+ 37*boost::lexical_cast<boost::math::ntl::RR>("0.271951506225063286130946773813524945052e50"),
+ 38*boost::lexical_cast<boost::math::ntl::RR>("0.6548016291215163843464133978454065823866e48"),
+ 39*boost::lexical_cast<boost::math::ntl::RR>("0.1456062447610542135403751730809295219344e47"),
+ 40*boost::lexical_cast<boost::math::ntl::RR>("0.2986690175077969760978388356833006028929e45"),
+ 41*boost::lexical_cast<boost::math::ntl::RR>("5643149706574013350061247429006443326844000"),
+ 42*boost::lexical_cast<boost::math::ntl::RR>("98047545414467090421964387960743688053480"),
+ 43*boost::lexical_cast<boost::math::ntl::RR>("1563378767746846395507385099301468978550"),
+ 44*boost::lexical_cast<boost::math::ntl::RR>("22823360528584500077862274918382796495"),
+ 45*boost::lexical_cast<boost::math::ntl::RR>("304215527004115213046601295970388750"),
+ 46*boost::lexical_cast<boost::math::ntl::RR>("3690289075895685793844344966820325"),
+ 47*boost::lexical_cast<boost::math::ntl::RR>("40584512015702371433911456606050"),
+ 48*boost::lexical_cast<boost::math::ntl::RR>("402834190897282802772754873905"),
+ 49*boost::lexical_cast<boost::math::ntl::RR>("3589522158493606918146495750"),
+ 50*boost::lexical_cast<boost::math::ntl::RR>("28530557707503483723634725"),
+ 51*boost::lexical_cast<boost::math::ntl::RR>("200714561335055753000730"),
+ 52*boost::lexical_cast<boost::math::ntl::RR>("1237953783437761888641"),
+ 53*boost::lexical_cast<boost::math::ntl::RR>("6614698701445762950"),
+ 54*boost::lexical_cast<boost::math::ntl::RR>("30155495647727505"),
+ 55*boost::lexical_cast<boost::math::ntl::RR>("114953256021450"),
+ 56*boost::lexical_cast<boost::math::ntl::RR>("356398020013"),
+ 57*boost::lexical_cast<boost::math::ntl::RR>("863113950"),
+ 58*boost::lexical_cast<boost::math::ntl::RR>("1531345"),
+ 59*boost::lexical_cast<boost::math::ntl::RR>("1770"),
+ 60*boost::lexical_cast<boost::math::ntl::RR>("1")
       };
    static const double g = 63.192152;
 
- NTL::RR zgh = x + g - 0.5;
+ boost::math::ntl::RR zgh = x + g - 0.5;
 
- NTL::RR result = (x - 0.5) / zgh;
+ boost::math::ntl::RR result = (x - 0.5) / zgh;
    result += log(zgh);
    result += tools::evaluate_polynomial(PD, x) / tools::evaluate_polynomial(P, x);
    result -= tools::evaluate_polynomial(QD, x) / tools::evaluate_polynomial(Q, x);
@@ -279,11 +278,11 @@
    return result;
 }
 
-NTL::RR digamma(NTL::RR x)
+boost::math::ntl::RR digamma(boost::math::ntl::RR x)
 {
    if(x < 0)
    {
- return digamma_imp(1-x) + constants::pi<NTL::RR>() / tan(constants::pi<NTL::RR>() * (1-x));
+ return digamma_imp(1-x) + constants::pi<boost::math::ntl::RR>() / tan(constants::pi<boost::math::ntl::RR>() * (1-x));
    }
    return digamma_imp(x);
 }

Modified: sandbox/math_toolkit/libs/math/tools/ntl_rr_lanczos.hpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/ntl_rr_lanczos.hpp (original)
+++ sandbox/math_toolkit/libs/math/tools/ntl_rr_lanczos.hpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -6,7 +6,7 @@
 #ifndef BOOST_LARGE_LANCZOS_HPP
 #define BOOST_LARGE_LANCZOS_HPP
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/math/special_functions/lanczos.hpp>
 #include <boost/lexical_cast.hpp>
 
@@ -882,7 +882,7 @@
 namespace boost{ namespace math{ namespace lanczos{
 
 template<class Policy>
-struct lanczos<NTL::RR, Policy>
+struct lanczos<boost::math::ntl::RR, Policy>
 {
 #ifdef L13
    typedef lanczos13UDT type;

Added: sandbox/math_toolkit/libs/math/tools/process_perf_results.cpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/tools/process_perf_results.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -0,0 +1,127 @@
+// Copyright John Maddock 2007.
+
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <map>
+#include <fstream>
+#include <iostream>
+#include <boost/regex.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/format.hpp>
+#include <boost/math/special_functions.hpp>
+
+std::map<std::string, double> results;
+
+std::map<std::string, std::string> extra_text;
+
+void load_file(std::string& s, std::istream& is)
+{
+ s.erase();
+ if(is.bad()) return;
+ s.reserve(is.rdbuf()->in_avail());
+ char c;
+ while(is.get(c))
+ {
+ if(s.capacity() == s.size())
+ s.reserve(s.capacity() * 3);
+ s.append(1, c);
+ }
+}
+
+int main(int argc, const char* argv[])
+{
+ //
+ // Set any additional text that should accumpany specific results:
+ //
+ extra_text["msvc-dist-beta-R-quantile"] = "[footnote There are a small number of our test cases where the R library fails to converge on a result: these tend to dominate the performance result.]";
+ extra_text["msvc-dist-nbinom-R-quantile"] = "[footnote The R library appears to use a linear-search strategy, that can perform very badly in a small number of pathological cases, but may or may not be more efficient in \"typical\" cases]";
+ extra_text["gcc-4_2-dist-beta-R-quantile"] = "[footnote There are a small number of our test cases where the R library fails to converge on a result: these tend to dominate the performance result.]";
+ extra_text["gcc-4_2-dist-nbinom-R-quantile"] = "[footnote The R library appears to use a linear-search strategy, that can perform very badly in a small number of pathological cases, but may or may not be more efficient in \"typical\" cases]";
+ boost::regex e("^Testing\\s+(\\S+)\\s+(\\S+)");
+ std::string f;
+ for(int i = 1; i < argc-1; ++i)
+ {
+ std::ifstream is(argv[i]);
+ load_file(f, is);
+ boost::sregex_iterator a(f.begin(), f.end(), e), b;
+ while(a != b)
+ {
+ results[(*a).str(1)] = boost::lexical_cast<double>((*a).str(2));
+ ++a;
+ }
+ }
+ //
+ // Load quickbook file:
+ //
+ std::ifstream is(argv[argc-1]);
+ std::ofstream os(std::string(argv[argc-1]).append(".bak").c_str());
+ e.assign("\\[perf\\s+([^\\s.]+)(?:\\[[^\\]]*\\]|[^\\]])*\\]");
+ std::string newfile;
+ while(is.good())
+ {
+ std::getline(is, f);
+ os << f << std::endl;
+ boost::sregex_iterator i(f.begin(), f.end(), e), j;
+ double min = (std::numeric_limits<double>::max)();
+ while(i != j)
+ {
+ std::cout << (*i).str() << std::endl << (*i).str(1) << std::endl;
+ std::string item = (*i).str(1);
+ if(results.find(item) != results.end())
+ {
+ double r = results[item];
+ if(r < min)
+ min = r;
+ }
+ ++i;
+ }
+ //
+ // Now perform the substitutions:
+ //
+ std::string newstr;
+ std::string tail;
+ i = boost::sregex_iterator(f.begin(), f.end(), e);
+ while(i != j)
+ {
+ std::string item = (*i).str(1);
+ newstr.append(i->prefix());
+ if(results.find(item) != results.end())
+ {
+ double v = results[item];
+ double r = v / min;
+ newstr += std::string((*i)[0].first, (*i)[1].second);
+ newstr += "..[para ";
+ if(r < 1.01)
+ newstr += "*";
+ newstr += (boost::format("%.2f") % r).str();
+ if(r < 1.01)
+ newstr += "*";
+ if(extra_text.find(item) != extra_text.end())
+ {
+ newstr += extra_text[item];
+ }
+ newstr += "][para (";
+ newstr += (boost::format("%.3e") % results[item]).str();
+ newstr += "s)]]";
+ }
+ else
+ {
+ newstr.append(i->str());
+ std::cerr << "Item " << item << " not found!!" << std::endl;
+ }
+ tail = i->suffix();
+ ++i;
+ }
+ if(newstr.size())
+ newfile.append(newstr).append(tail);
+ else
+ newfile.append(f);
+ newfile.append("\n");
+ }
+ is.close();
+ std::ofstream ns(argv[argc-1]);
+ ns << newfile;
+}
+

Modified: sandbox/math_toolkit/libs/math/tools/rational_tests.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/rational_tests.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/rational_tests.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -1,5 +1,5 @@
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/tr1/random.hpp>
 #include <boost/math/tools/rational.hpp>
 #include <iostream>
@@ -10,8 +10,8 @@
    using namespace boost::math;
    using namespace boost::math::tools;
 
- NTL::RR::SetPrecision(500);
- NTL::RR::SetOutputPrecision(40);
+ boost::math::ntl::RR::SetPrecision(500);
+ boost::math::ntl::RR::SetOutputPrecision(40);
 
    std::tr1::mt19937 rnd;
    std::tr1::variate_generator<
@@ -47,10 +47,10 @@
       }
       std::cout << " };\n";
 
- NTL::RR r1 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.125), i);
- NTL::RR r2 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.25), i);
- NTL::RR r3 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.75), i);
- NTL::RR r4 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(1) - NTL::RR(1) / 64, i);
+ boost::math::ntl::RR r1 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.125), i);
+ boost::math::ntl::RR r2 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.25), i);
+ boost::math::ntl::RR r3 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.75), i);
+ boost::math::ntl::RR r4 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(1) - boost::math::ntl::RR(1) / 64, i);
 
       std::cout <<
          " BOOST_CHECK_CLOSE(\n"
@@ -115,10 +115,10 @@
          " static_cast<T>(" << r4 << "L),\n"
          " tolerance);\n\n";
 
- r1 = boost::math::tools::evaluate_even_polynomial(&coef[0], NTL::RR(0.125), i);
- r2 = boost::math::tools::evaluate_even_polynomial(&coef[0], NTL::RR(0.25), i);
- r3 = boost::math::tools::evaluate_even_polynomial(&coef[0], NTL::RR(0.75), i);
- r4 = boost::math::tools::evaluate_even_polynomial(&coef[0], NTL::RR(1) - NTL::RR(1) / 64, i);
+ r1 = boost::math::tools::evaluate_even_polynomial(&coef[0], boost::math::ntl::RR(0.125), i);
+ r2 = boost::math::tools::evaluate_even_polynomial(&coef[0], boost::math::ntl::RR(0.25), i);
+ r3 = boost::math::tools::evaluate_even_polynomial(&coef[0], boost::math::ntl::RR(0.75), i);
+ r4 = boost::math::tools::evaluate_even_polynomial(&coef[0], boost::math::ntl::RR(1) - boost::math::ntl::RR(1) / 64, i);
 
       std::cout <<
          " BOOST_CHECK_CLOSE(\n"
@@ -185,10 +185,10 @@
 
       if(i > 1)
       {
- r1 = boost::math::tools::evaluate_odd_polynomial(&coef[0], NTL::RR(0.125), i);
- r2 = boost::math::tools::evaluate_odd_polynomial(&coef[0], NTL::RR(0.25), i);
- r3 = boost::math::tools::evaluate_odd_polynomial(&coef[0], NTL::RR(0.75), i);
- r4 = boost::math::tools::evaluate_odd_polynomial(&coef[0], NTL::RR(1) - NTL::RR(1) / 64, i);
+ r1 = boost::math::tools::evaluate_odd_polynomial(&coef[0], boost::math::ntl::RR(0.125), i);
+ r2 = boost::math::tools::evaluate_odd_polynomial(&coef[0], boost::math::ntl::RR(0.25), i);
+ r3 = boost::math::tools::evaluate_odd_polynomial(&coef[0], boost::math::ntl::RR(0.75), i);
+ r4 = boost::math::tools::evaluate_odd_polynomial(&coef[0], boost::math::ntl::RR(1) - boost::math::ntl::RR(1) / 64, i);
 
          std::cout <<
             " BOOST_CHECK_CLOSE(\n"
@@ -254,10 +254,10 @@
             " tolerance);\n\n";
       }
 
- r1 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.125), i);
- r2 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.25), i);
- r3 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.75), i);
- r4 = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(1) - NTL::RR(1) / 64, i);
+ r1 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.125), i);
+ r2 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.25), i);
+ r3 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.75), i);
+ r4 = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(1) - boost::math::ntl::RR(1) / 64, i);
 
       coef.clear();
       for(unsigned j = 0; j < i; ++j)
@@ -286,10 +286,10 @@
       }
       std::cout << " };\n";
 
- NTL::RR r1d = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.125), i);
- NTL::RR r2d = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.25), i);
- NTL::RR r3d = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(0.75), i);
- NTL::RR r4d = boost::math::tools::evaluate_polynomial(&coef[0], NTL::RR(1) - NTL::RR(1) / 64, i);
+ boost::math::ntl::RR r1d = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.125), i);
+ boost::math::ntl::RR r2d = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.25), i);
+ boost::math::ntl::RR r3d = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(0.75), i);
+ boost::math::ntl::RR r4d = boost::math::tools::evaluate_polynomial(&coef[0], boost::math::ntl::RR(1) - boost::math::ntl::RR(1) / 64, i);
 
       std::cout <<
          " BOOST_CHECK_CLOSE(\n"

Modified: sandbox/math_toolkit/libs/math/tools/spherical_harmonic_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/spherical_harmonic_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/spherical_harmonic_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -1,5 +1,5 @@
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/math/tools/test_data.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/spherical_harmonic.hpp>
@@ -45,11 +45,11 @@
 {
    using namespace boost::math::tools;
 
- NTL::RR::SetOutputPrecision(50);
- NTL::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(50);
+ boost::math::ntl::RR::SetPrecision(1000);
 
- parameter_info<NTL::RR> arg1, arg2, arg3;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1, arg2, arg3;
+ test_data<boost::math::ntl::RR> data;
 
    bool cont;
    std::string line;
@@ -64,7 +64,7 @@
       arg2.type |= dummy_param;
       arg3 = arg2;
 
- data.insert(&spherical_harmonic_data<NTL::RR>, arg1);
+ data.insert(&spherical_harmonic_data<boost::math::ntl::RR>, arg1);
 
       std::cout << "Any more data [y/n]?";
       std::getline(std::cin, line);

Modified: sandbox/math_toolkit/libs/math/tools/tgamma_ratio_data.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/tools/tgamma_ratio_data.cpp (original)
+++ sandbox/math_toolkit/libs/math/tools/tgamma_ratio_data.cpp 2007-09-13 12:56:24 EDT (Thu, 13 Sep 2007)
@@ -3,7 +3,7 @@
 // Boost Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/math/tools/ntl.hpp>
+#include <boost/math/bindings/rr.hpp>
 #include <boost/test/included/test_exec_monitor.hpp>
 #include <boost/math/special_functions/gamma.hpp>
 #include <boost/math/tools/test.hpp>
@@ -16,21 +16,21 @@
 using namespace boost::math::tools;
 using namespace std;
 
-std::tr1::tuple<NTL::RR, NTL::RR>
- tgamma_ratio(const NTL::RR& a, const NTL::RR& delta)
+std::tr1::tuple<boost::math::ntl::RR, boost::math::ntl::RR>
+ tgamma_ratio(const boost::math::ntl::RR& a, const boost::math::ntl::RR& delta)
 {
    if(delta > a)
       throw std::domain_error("");
- NTL::RR tg = boost::math::tgamma(a);
- NTL::RR r1 = tg / boost::math::tgamma(a + delta);
- NTL::RR r2 = tg / boost::math::tgamma(a - delta);
+ boost::math::ntl::RR tg = boost::math::tgamma(a);
+ boost::math::ntl::RR r1 = tg / boost::math::tgamma(a + delta);
+ boost::math::ntl::RR r2 = tg / boost::math::tgamma(a - delta);
    if((r1 > (std::numeric_limits<float>::max)()) || (r2 > (std::numeric_limits<float>::max)()))
       throw std::domain_error("");
 
    return std::tr1::make_tuple(r1, r2);
 }
 
-NTL::RR tgamma_ratio2(const NTL::RR& a, const NTL::RR& b)
+boost::math::ntl::RR tgamma_ratio2(const boost::math::ntl::RR& a, const boost::math::ntl::RR& b)
 {
    return boost::math::tgamma(a) / boost::math::tgamma(b);
 }
@@ -38,11 +38,11 @@
 
 int test_main(int argc, char*argv [])
 {
- NTL::RR::SetPrecision(1000);
- NTL::RR::SetOutputPrecision(40);
+ boost::math::ntl::RR::SetPrecision(1000);
+ boost::math::ntl::RR::SetOutputPrecision(40);
 
- parameter_info<NTL::RR> arg1, arg2;
- test_data<NTL::RR> data;
+ parameter_info<boost::math::ntl::RR> arg1, arg2;
+ test_data<boost::math::ntl::RR> data;
 
    bool cont;
    std::string line;


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