Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75586 - in sandbox/big_number: boost/multiprecision boost/multiprecision/concepts boost/multiprecision/detail boost/multiprecision/detail/functions libs/multiprecision/test
From: john_at_[hidden]
Date: 2011-11-21 04:52:36


Author: johnmaddock
Date: 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
New Revision: 75586
URL: http://svn.boost.org/trac/boost/changeset/75586

Log:
Suppress MSVC warnings in tests.
Add support for std::ios_base::fmtflags in string formatting.
Fix the errors that result from above change!
Text files modified:
   sandbox/big_number/boost/multiprecision/arithmetic_backend.hpp | 16 +--
   sandbox/big_number/boost/multiprecision/concepts/mp_number_architypes.hpp | 17 +---
   sandbox/big_number/boost/multiprecision/cpp_float.hpp | 42 ++++++++---
   sandbox/big_number/boost/multiprecision/detail/default_ops.hpp | 4
   sandbox/big_number/boost/multiprecision/detail/functions/constants.hpp | 6
   sandbox/big_number/boost/multiprecision/detail/functions/pow.hpp | 8 +-
   sandbox/big_number/boost/multiprecision/detail/functions/trig.hpp | 8 +-
   sandbox/big_number/boost/multiprecision/detail/mp_number_base.hpp | 8 ++
   sandbox/big_number/boost/multiprecision/gmp.hpp | 87 ++++++++++++++++++-----
   sandbox/big_number/boost/multiprecision/mp_number.hpp | 34 ++++++---
   sandbox/big_number/boost/multiprecision/mpfr.hpp | 49 ++++++++-----
   sandbox/big_number/boost/multiprecision/tommath.hpp | 145 ++++++++++++++++++++++++++-------------
   sandbox/big_number/libs/multiprecision/test/mp_number_concept_check.cpp | 2
   sandbox/big_number/libs/multiprecision/test/test.hpp | 1
   sandbox/big_number/libs/multiprecision/test/test_acos.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp | 22 +++--
   sandbox/big_number/libs/multiprecision/test/test_asin.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_atan.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_cos.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_cosh.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_exp.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_fpclassify.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_gmp_conversions.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_log.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_mpfr_conversions.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_numeric_limits.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_pow.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_round.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_sin.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_sinh.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_sqrt.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_tanh.cpp | 4 +
   sandbox/big_number/libs/multiprecision/test/test_test.cpp | 4 +
   33 files changed, 361 insertions(+), 160 deletions(-)

Modified: sandbox/big_number/boost/multiprecision/arithmetic_backend.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/arithmetic_backend.hpp (original)
+++ sandbox/big_number/boost/multiprecision/arithmetic_backend.hpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -8,6 +8,7 @@
 
 #include <iostream>
 #include <iomanip>
+#include <sstream>
 #include <boost/cstdint.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/multiprecision/mp_number.hpp>
@@ -62,9 +63,12 @@
    {
       std::swap(m_value, o.m_value);
    }
- std::string str(unsigned digits, bool scientific)const
+ std::string str(std::streamsize digits, std::ios_base::fmtflags f)const
    {
- return boost::lexical_cast<std::string>(m_value);
+ std::stringstream ss;
+ ss.flags(f);
+ ss << std::setprecision(digits) << m_data;
+ return ss.str();
    }
    void negate()
    {
@@ -118,10 +122,6 @@
 
 namespace std{
 
-#ifdef BOOST_NO_NOEXCEPT
-# define BOOST_MP_NOEXCEPT
-#endif
-
 template <class Arithmetic>
 class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::arithmetic_backend<Arithmetic> > > : public std::numeric_limits<Arithmetic>
 {
@@ -139,10 +139,6 @@
    BOOST_STATIC_CONSTEXPR number_type denorm_min() BOOST_MP_NOEXCEPT { return base_type::denorm_min(); }
 };
 
-#ifdef BOOST_NO_NOEXCEPT
-# undef BOOST_MP_NOEXCEPT
-#endif
-
 }
 
 #endif

Modified: sandbox/big_number/boost/multiprecision/concepts/mp_number_architypes.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/concepts/mp_number_architypes.hpp (original)
+++ sandbox/big_number/boost/multiprecision/concepts/mp_number_architypes.hpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -74,20 +74,19 @@
       std::cout << "Swapping (" << m_value << " with " << o.m_value << ")" << std::endl;
       std::swap(m_value, o.m_value);
    }
- std::string str(unsigned digits, bool scientific)const
+ std::string str(std::streamsize digits, std::ios_base::fmtflags f)const
    {
       std::stringstream ss;
- if(scientific)
- ss.setf(ss.scientific);
+ ss.flags(f);
       if(digits)
          ss.precision(digits);
       else
          ss.precision(std::numeric_limits<long double>::digits10 + 2);
       boost::intmax_t i = m_value;
       boost::uintmax_t u = m_value;
- if(!scientific && m_value == i)
+ if(!(f & std::ios_base::scientific) && m_value == i)
          ss << i;
- else if(!scientific && m_value == u)
+ else if(!(f & std::ios_base::scientific) && m_value == u)
          ss << u;
       else
          ss << m_value;
@@ -193,10 +192,6 @@
 
 namespace std{
 
-#ifdef BOOST_NO_NOEXCEPT
-# define BOOST_MP_NOEXCEPT
-#endif
-
 template <>
 class numeric_limits<boost::multiprecision::concepts::mp_number_float_architype> : public std::numeric_limits<long double>
 {
@@ -214,10 +209,6 @@
    BOOST_STATIC_CONSTEXPR number_type denorm_min() BOOST_MP_NOEXCEPT { return base_type::denorm_min(); }
 };
 
-#ifdef BOOST_NO_NOEXCEPT
-# undef BOOST_MP_NOEXCEPT
-#endif
-
 }
 
 #ifdef BOOST_MSVC

Modified: sandbox/big_number/boost/multiprecision/cpp_float.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/cpp_float.hpp (original)
+++ sandbox/big_number/boost/multiprecision/cpp_float.hpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -171,7 +171,7 @@
       prec_elem(mp_elem_number)
    {
       // TODO: this doesn't round!
- std::copy_n(f.data.begin(), std::min(f.prec_elem, prec_elem), data.begin());
+ std::copy(f.data.begin(), f.data.begin() + std::min(f.prec_elem, prec_elem), data.begin());
       precision(std::min(f.prec_elem, prec_elem));
    }
 
@@ -317,7 +317,7 @@
       exp = f.exp;
       neg = f.neg;
       fpclass = static_cast<enum_fpclass>(static_cast<int>(f.fpclass));
- std::copy_n(f.data.begin(), std::min(f.prec_elem, prec_elem), data.begin());
+ std::copy(f.data.begin(), f.data.begin() + std::min(f.prec_elem, prec_elem), data.begin());
       precision(std::min(f.prec_elem, prec_elem));
       return *this;
    }
@@ -396,7 +396,7 @@
       return *this -= one();
    }
 
- std::string str(unsigned digits, bool scientific)const;
+ std::string str(std::streamsize digits, std::ios_base::fmtflags f)const;
 
    int compare(const cpp_float& v)const;
    template <class V>
@@ -1460,7 +1460,7 @@
 
    std::stringstream ss;
 
- ss << str(std::numeric_limits<double>::digits10 + (2 + 1), true);
+ ss << str(std::numeric_limits<double>::digits10 + (2 + 1), std::ios_base::scientific);
 
    double d;
    ss >> d;
@@ -1506,7 +1506,7 @@
 
    std::stringstream ss;
 
- ss << str(std::numeric_limits<long double>::digits10 + (2 + 1), true);
+ ss << str(std::numeric_limits<long double>::digits10 + (2 + 1), std::ios_base::scientific);
 
    long double ld;
    ss >> ld;
@@ -1639,8 +1639,12 @@
 }
 
 template <unsigned Digits10>
-std::string cpp_float<Digits10>::str(std::size_t number_of_digits, bool scientific) const
+std::string cpp_float<Digits10>::str(std::streamsize number_of_digits, std::ios_base::fmtflags f) const
 {
+ bool scientific = (f & std::ios_base::scientific) == std::ios_base::scientific;
+ bool fixed = (f & std::ios_base::fixed) == std::ios_base::fixed;
+ bool showpoint = (f & std::ios_base::showpoint) == std::ios_base::showpoint;
+
    std::string str;
    boost::int64_t my_exp = order();
    if(number_of_digits == 0)
@@ -1665,13 +1669,13 @@
    }
 
    // Cut the output to the size of the precision.
- if(str.length() > number_of_digits)
+ if(str.length() > static_cast<std::string::size_type>(number_of_digits))
    {
       // Get the digit after the last needed digit for rounding
- const boost::uint32_t round = static_cast<boost::uint32_t>(static_cast<boost::uint32_t>(str.at(number_of_digits)) - static_cast<boost::uint32_t>('0'));
+ const boost::uint32_t round = static_cast<boost::uint32_t>(static_cast<boost::uint32_t>(str[static_cast<std::string::size_type>(number_of_digits)]) - static_cast<boost::uint32_t>('0'));
 
       // Truncate the string
- str = str.substr(static_cast<std::size_t>(0u), number_of_digits);
+ str.erase(static_cast<std::string::size_type>(number_of_digits));
 
       if(round >= static_cast<boost::uint32_t>(5u))
       {
@@ -1716,18 +1720,30 @@
    str.erase(pos, str.end());
    if(str.empty())
       str = '0';
- if(!scientific && (str.size() < 20) && (my_exp >= 0) && (my_exp < 20))
+ if(fixed || (!scientific && (str.size() < 20) && (my_exp >= -3) && (my_exp < 20)))
    {
       if(1 + my_exp > str.size())
       {
          // Just pad out the end with zeros:
          str.append(static_cast<std::string::size_type>(1 + my_exp - str.size()), '0');
+ if(showpoint)
+ str.append(".0");
       }
       else if(my_exp + 1 != str.size())
       {
- // Insert the decimal point:
- str.insert(static_cast<std::string::size_type>(my_exp + 1), 1, '.');
+ if(my_exp < 0)
+ {
+ str.insert(0, static_cast<std::string::size_type>(-1-my_exp), '0');
+ str.insert(0, "0.");
+ }
+ else
+ {
+ // Insert the decimal point:
+ str.insert(static_cast<std::string::size_type>(my_exp + 1), 1, '.');
+ }
       }
+ else if(showpoint)
+ str += ".0";
    }
    else
    {
@@ -2711,7 +2727,7 @@
       static const bool is_bounded = true;
       static const bool is_modulo = false;
       static const bool is_iec559 = false;
- static const int digits = static_cast<int>(((Digits10 + 1) * 1000L) / 301L);
+ static const int digits = Digits10;
       static const int digits10 = boost::multiprecision::cpp_float<Digits10>::cpp_float_digits10;
       static const int max_digits10 = boost::multiprecision::cpp_float<Digits10>::cpp_float_max_digits10;
       static const boost::int64_t min_exponent = boost::multiprecision::cpp_float<Digits10>::cpp_float_min_exp; // Type differs from int.

Modified: sandbox/big_number/boost/multiprecision/detail/default_ops.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/default_ops.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/default_ops.hpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -19,7 +19,7 @@
 #define INSTRUMENT_BACKEND(x)
 #else
 #define INSTRUMENT_BACKEND(x)\
- std::cout << BOOST_STRINGIZE(x) << " = " << x.str(0, true) << std::endl;
+ std::cout << BOOST_STRINGIZE(x) << " = " << x.str(0, std::ios_base::scientific) << std::endl;
 #endif
 #endif
 
@@ -339,7 +339,7 @@
    // We ran out of types to try for the convertion, try
    // a lexical_cast and hope for the best:
    //
- result->value = boost::lexical_cast<R>(backend.str(0, false));
+ result->value = boost::lexical_cast<R>(backend.str(0, std::ios_base::fmtflags(0)));
 }
 
 //

Modified: sandbox/big_number/boost/multiprecision/detail/functions/constants.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/functions/constants.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/functions/constants.hpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -146,7 +146,7 @@
    static bool b = false;
    if(!b)
    {
- calc_log2(result, std::numeric_limits<mp_number<T> >::digits);
+ calc_log2(result, boost::multiprecision::detail::digits2<mp_number<T> >::value);
       b = true;
    }
 
@@ -162,7 +162,7 @@
    static bool b = false;
    if(!b)
    {
- calc_e(result, std::numeric_limits<mp_number<T> >::digits);
+ calc_e(result, boost::multiprecision::detail::digits2<mp_number<T> >::value);
       b = true;
    }
 
@@ -178,7 +178,7 @@
    static bool b = false;
    if(!b)
    {
- calc_pi(result, std::numeric_limits<mp_number<T> >::digits);
+ calc_pi(result, boost::multiprecision::detail::digits2<mp_number<T> >::value);
       b = true;
    }
 

Modified: sandbox/big_number/boost/multiprecision/detail/functions/pow.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/functions/pow.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/functions/pow.hpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -100,7 +100,7 @@
    typedef typename mpl::front<typename T::unsigned_types>::type ui_type;
 
    BOOST_ASSERT(&H0F0 != &x);
- long tol = std::numeric_limits<mp_number<T> >::digits;
+ long tol = boost::multiprecision::detail::digits2<mp_number<T> >::value;
    T t;
 
    T x_pow_n_div_n_fact(x);
@@ -156,7 +156,7 @@
    multiply(H1F0, pochham_a, x_pow_n_div_n_fact);
    add(H1F0, si_type(1));
    T lim;
- eval_ldexp(lim, H1F0, 1 - std::numeric_limits<mp_number<T> >::digits);
+ eval_ldexp(lim, H1F0, 1 - boost::multiprecision::detail::digits2<mp_number<T> >::value);
    if(get_sign(lim) < 0)
       lim.negate();
 
@@ -164,7 +164,7 @@
    T term, part;
 
    // Series expansion of hyperg_1f0(a; ; x).
- for(n = 2; n < std::numeric_limits<mp_number<T> >::digits + 10; n++)
+ for(n = 2; n < boost::multiprecision::detail::digits2<mp_number<T> >::value + 10; n++)
    {
       multiply(x_pow_n_div_n_fact, x);
       divide(x_pow_n_div_n_fact, n);
@@ -177,7 +177,7 @@
       if(lim.compare(term) >= 0)
          break;
    }
- if(n >= std::numeric_limits<mp_number<T> >::digits + 10)
+ if(n >= boost::multiprecision::detail::digits2<mp_number<T> >::value + 10)
       BOOST_THROW_EXCEPTION(std::runtime_error("H1F0 failed to converge"));
 }
 

Modified: sandbox/big_number/boost/multiprecision/detail/functions/trig.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/functions/trig.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/functions/trig.hpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -36,7 +36,7 @@
 
    T tol;
    tol = ui_type(1);
- eval_ldexp(tol, tol, 1 - std::numeric_limits<mp_number<T> >::digits);
+ eval_ldexp(tol, tol, 1 - boost::multiprecision::detail::digits2<mp_number<T> >::value);
    multiply(tol, result);
    if(get_sign(tol) < 0)
       tol.negate();
@@ -375,7 +375,7 @@
    add(result, ui_type(1));
 
    T lim;
- eval_ldexp(lim, result, 1 - std::numeric_limits<mp_number<T> >::digits);
+ eval_ldexp(lim, result, 1 - boost::multiprecision::detail::digits2<mp_number<T> >::value);
 
    if(get_sign(lim) < 0)
       lim.negate();
@@ -507,7 +507,7 @@
       subtract(result, s);
 
       T lim;
- eval_ldexp(lim, result, 1 - std::numeric_limits<mp_number<T> >::digits);
+ eval_ldexp(lim, result, 1 - boost::multiprecision::detail::digits2<mp_number<T> >::value);
       if(get_sign(s) < 0)
          s.negate();
       if(get_sign(lim) < 0)
@@ -751,7 +751,7 @@
 typename disable_if<is_same<T, Arithmetic> >::type eval_atan2(T& result, const T& a, const Arithmetic& b)
 {
    T x;
- x = b;
+ x = static_cast<typename boost::multiprecision::detail::canonical<Arithmetic, T>::type>(b);
    eval_atan2(result, a, x);
 }
 

Modified: sandbox/big_number/boost/multiprecision/detail/mp_number_base.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/mp_number_base.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/mp_number_base.hpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -337,6 +337,14 @@
    typename mp_exp_storage<Arg3>::type arg3;
 };
 
+template <class T>
+struct digits2
+{
+ BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_specialized);
+ BOOST_STATIC_ASSERT((std::numeric_limits<T>::radix == 2) || (std::numeric_limits<T>::radix == 10));
+ static const long value = std::numeric_limits<T>::radix == 10 ? (((std::numeric_limits<T>::digits + 1) * 1000L) / 301L) : std::numeric_limits<T>::digits;
+};
+
 } // namespace detail
 
 //

Modified: sandbox/big_number/boost/multiprecision/gmp.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/gmp.hpp (original)
+++ sandbox/big_number/boost/multiprecision/gmp.hpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -159,30 +159,48 @@
    {
       mpf_swap(m_data, o.m_data);
    }
- std::string str(unsigned digits, bool scientific)const
+ std::string str(std::streamsize digits, std::ios_base::fmtflags f)const
    {
+ bool scientific = (f & std::ios_base::scientific) == std::ios_base::scientific;
+ bool fixed = (f & std::ios_base::fixed) == std::ios_base::fixed;
+ bool showpoint = (f & std::ios_base::showpoint) == std::ios_base::showpoint;
+
       std::string result;
       mp_exp_t e;
       void *(*alloc_func_ptr) (size_t);
       void *(*realloc_func_ptr) (void *, size_t, size_t);
       void (*free_func_ptr) (void *, size_t);
- const char* ps = mpf_get_str (0, &e, 10, digits, m_data);
+ const char* ps = mpf_get_str (0, &e, 10, static_cast<std::size_t>(digits), m_data);
       std::ptrdiff_t sl = std::strlen(ps);
       if(sl == 0)
          return "0";
       if(*ps == '-')
          --sl; // number of digits excluding sign.
- if(!scientific
- && (sl <= std::numeric_limits<boost::uintmax_t>::digits10 + 1)
- && (e >= sl)
- && (sl <= std::numeric_limits<boost::uintmax_t>::digits10 + 1))
+ result = ps;
+ if(fixed || (!scientific && (e > -4) && (e <= std::numeric_limits<boost::uintmax_t>::digits10 + 2)))
       {
- result = ps;
- result.append(e-sl, '0');
+ if(1 + e >= sl)
+ {
+ result.append(e - sl, '0');
+ if(showpoint)
+ result.append(".0");
+ }
+ else
+ {
+ if(e <= 0)
+ {
+ result.insert(0, -e, '0');
+ result.insert(0, "0.");
+ }
+ else
+ {
+ // Insert the decimal point:
+ result.insert(e, 1, '.');
+ }
+ }
       }
       else
       {
- result = ps;
          if(ps[0] == '-')
             result.insert(2, 1, '.');
          else
@@ -920,7 +938,26 @@
    }
    gmp_int& operator = (const char* s)
    {
- mpz_set_str(m_data, s, 10);
+ std::size_t n = s ? std::strlen(s) : 0;
+ int radix = 10;
+ if(n && (*s == '0'))
+ {
+ if((n > 1) && ((s[1] == 'x') || (s[1] == 'X')))
+ {
+ radix = 16;
+ s +=2;
+ n -= 2;
+ }
+ else
+ {
+ radix = 8;
+ n -= 1;
+ }
+ }
+ if(n)
+ mpz_set_str(m_data, s, radix);
+ else
+ mpz_set_ui(m_data, 0);
       return *this;
    }
    gmp_int& operator=(const mpf_t& val)
@@ -949,15 +986,30 @@
    {
       mpz_swap(m_data, o.m_data);
    }
- std::string str(unsigned /*digits*/, bool /*scientific*/)const
+ std::string str(std::streamsize /*digits*/, std::ios_base::fmtflags f)const
    {
+ int base = 10;
+ if((f & std::ios_base::oct) == std::ios_base::oct)
+ base = 8;
+ else if((f & std::ios_base::hex) == std::ios_base::hex)
+ base = 16;
       void *(*alloc_func_ptr) (size_t);
       void *(*realloc_func_ptr) (void *, size_t, size_t);
       void (*free_func_ptr) (void *, size_t);
- const char* ps = mpz_get_str (0, 10, m_data);
+ const char* ps = mpz_get_str (0, base, m_data);
       std::string s = ps;
       mp_get_memory_functions(&alloc_func_ptr, &realloc_func_ptr, &free_func_ptr);
       (*free_func_ptr)((void*)ps, std::strlen(ps) + 1);
+
+ if((base != 10) && (f & std::ios_base::showbase))
+ {
+ int pos = s[0] == '-' ? 1 : 0;
+ const char* pp = base == 8 ? "0" : "0x";
+ s.insert(pos, pp);
+ }
+ if((f & std::ios_base::showpos) && (s[0] != '-'))
+ s.insert(0, 1, '+');
+
       return s;
    }
    ~gmp_int()
@@ -1443,8 +1495,9 @@
    {
       mpq_swap(m_data, o.m_data);
    }
- std::string str(unsigned /*digits*/, bool /*scientific*/)const
+ std::string str(std::streamsize /*digits*/, std::ios_base::fmtflags f)const
    {
+ // TODO make a better job of this including handling of f!!
       void *(*alloc_func_ptr) (size_t);
       void *(*realloc_func_ptr) (void *, size_t, size_t);
       void (*free_func_ptr) (void *, size_t);
@@ -1655,10 +1708,6 @@
 
 namespace std{
 
-#ifdef BOOST_NO_NOEXCEPT
-# define BOOST_MP_NOEXCEPT
-#endif
-
 //
 // numeric_limits [partial] specializations for the types declared in this header:
 //
@@ -1906,10 +1955,6 @@
    BOOST_STATIC_CONSTEXPR float_round_style round_style = round_toward_zero;
 };
 
-#ifdef BOOST_NO_NOEXCEPT
-# undef BOOST_MP_NOEXCEPT
-#endif
-
 } // namespace std
 
 #endif

Modified: sandbox/big_number/boost/multiprecision/mp_number.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/mp_number.hpp (original)
+++ sandbox/big_number/boost/multiprecision/mp_number.hpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -446,9 +446,9 @@
    //
    // String conversion functions:
    //
- std::string str(unsigned digits = 0, bool scientific = true)const
+ std::string str(std::streamsize digits = 0, std::ios_base::fmtflags f = std::ios_base::fmtflags(0))const
    {
- return m_backend.str(digits, scientific);
+ return m_backend.str(digits, f);
    }
    template <class T>
    T convert_to()const
@@ -981,7 +981,7 @@
    template <class F, class Exp>
    void do_assign_function_1(const F& f, const Exp& val, const detail::terminal&)
    {
- f(m_backend, canonical_value(val.value()));
+ f(m_backend, function_arg_value(val.value()));
    }
    template <class F, class Exp, class Tag>
    void do_assign_function_1(const F& f, const Exp& val, const Tag&)
@@ -1001,19 +1001,19 @@
    template <class F, class Exp1, class Exp2>
    void do_assign_function_2(const F& f, const Exp1& val1, const Exp2& val2, const detail::terminal&, const detail::terminal&)
    {
- f(m_backend, canonical_value(val1.value()), canonical_value(val2.value()));
+ f(m_backend, function_arg_value(val1.value()), function_arg_value(val2.value()));
    }
    template <class F, class Exp1, class Exp2, class Tag1>
    void do_assign_function_2(const F& f, const Exp1& val1, const Exp2& val2, const Tag1&, const detail::terminal&)
    {
       self_type temp1(val1);
- f(m_backend, temp1.backend(), canonical_value(val2.value()));
+ f(m_backend, temp1.backend(), function_arg_value(val2.value()));
    }
    template <class F, class Exp1, class Exp2, class Tag2>
    void do_assign_function_2(const F& f, const Exp1& val1, const Exp2& val2, const detail::terminal&, const Tag2&)
    {
       self_type temp2(val2);
- f(m_backend, canonical_value(val1.value()), temp2.backend());
+ f(m_backend, function_arg_value(val1.value()), temp2.backend());
    }
    template <class F, class Exp1, class Exp2, class Tag1, class Tag2>
    void do_assign_function_2(const F& f, const Exp1& val1, const Exp2& val2, const Tag1&, const Tag2&)
@@ -1384,12 +1384,13 @@
    bool is_floatly_self(const self_type& v)const { return &v == this; }
 
    static const Backend& canonical_value(const self_type& v){ return v.m_backend; }
- //static const Backend& canonical_value(const self_type* v){ return v->m_backend; }
- //static const Backend& canonical_value(self_type* v){ return v->m_backend; }
- //static const Backend& canonical_value(self_type& v){ return v.m_backend; }
    template <class V>
    static typename detail::canonical<V, Backend>::type canonical_value(const V& v){ return v; }
    static typename detail::canonical<std::string, Backend>::type canonical_value(const std::string& v){ return v.c_str(); }
+
+ static const Backend& function_arg_value(const self_type& v) { return v.backend(); }
+ template <class V>
+ static const V& function_arg_value(const V& v) { return v; }
    Backend m_backend;
 };
 
@@ -1529,9 +1530,18 @@
 template <class Backend>
 inline std::ostream& operator << (std::ostream& os, const mp_number<Backend>& r)
 {
- unsigned d = os.precision();
- bool b = os.flags() & os.scientific;
- return os << r.str(d, b);
+ std::streamsize d = os.precision();
+ std::string s = r.str(d, os.flags());
+ std::streamsize ss = os.width();
+ if(ss > static_cast<std::streamsize>(s.size()))
+ {
+ char fill = os.fill();
+ if((os.flags() & std::ios_base::left) == std::ios_base::left)
+ s.append(static_cast<std::string::size_type>(ss - s.size()), fill);
+ else
+ s.insert(0, static_cast<std::string::size_type>(ss - s.size()), fill);
+ }
+ return os << s;
 }
 
 namespace detail{

Modified: sandbox/big_number/boost/multiprecision/mpfr.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/mpfr.hpp (original)
+++ sandbox/big_number/boost/multiprecision/mpfr.hpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -156,32 +156,51 @@
    {
       mpfr_swap(m_data, o.m_data);
    }
- std::string str(unsigned digits, bool scientific)const
+ std::string str(std::streamsize digits, std::ios_base::fmtflags f)const
    {
+ bool scientific = (f & std::ios_base::scientific) == std::ios_base::scientific;
+ bool fixed = (f & std::ios_base::fixed) == std::ios_base::fixed;
+ bool showpoint = (f & std::ios_base::showpoint) == std::ios_base::showpoint;
+
       std::string result;
       mp_exp_t e;
- char* ps = mpfr_get_str (0, &e, 10, digits, m_data, GMP_RNDN);
+ char* ps = mpfr_get_str (0, &e, 10, static_cast<std::size_t>(digits), m_data, GMP_RNDN);
       std::ptrdiff_t sl = std::strlen(ps);
- unsigned chars = sl;
+ int chars = sl;
       if(sl == 0)
          return "0";
       while(ps[chars-1] == '0')
          --chars;
+ ps[chars] = 0;
       if(*ps == '-')
          --chars; // number of digits excluding sign.
       if(chars == 0)
- return "0";
- if(!scientific
- && (chars <= std::numeric_limits<boost::uintmax_t>::digits10 + 1)
- && (e >= (int)chars)
- && (chars <= std::numeric_limits<boost::uintmax_t>::digits10 + 1))
+ return scientific ? "0.0e0" : showpoint ? "0.0" : "0";
+ result = ps;
+ if(fixed || (!scientific && (e > -4) && (e <= std::numeric_limits<boost::uintmax_t>::digits10 + 2)))
       {
- result.assign(ps, (*ps == '-' ? chars+1 : chars));
- result.append(e-chars, '0');
+ if(e >= chars)
+ {
+ result.append(e - chars, '0');
+ if(showpoint)
+ result.append(".0");
+ }
+ else
+ {
+ if(e <= 0)
+ {
+ result.insert(0, -e, '0');
+ result.insert(0, "0.");
+ }
+ else
+ {
+ // Insert the decimal point:
+ result.insert(e, 1, '.');
+ }
+ }
       }
       else
       {
- result = ps;
          if(ps[0] == '-')
             result.insert(2, 1, '.');
          else
@@ -966,10 +985,6 @@
 
 namespace std{
 
-#ifdef BOOST_NO_NOEXCEPT
-# define BOOST_MP_NOEXCEPT
-#endif
-
 //
 // numeric_limits [partial] specializations for the types declared in this header:
 //
@@ -1147,9 +1162,5 @@
    BOOST_STATIC_CONSTEXPR float_round_style round_style = round_toward_zero;
 };
 
-#ifdef BOOST_MP_NOEXCEPT
-#undef BOOST_MP_NOEXCEPT
-#endif
-
 } // namespace std
 #endif

Modified: sandbox/big_number/boost/multiprecision/tommath.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/tommath.hpp (original)
+++ sandbox/big_number/boost/multiprecision/tommath.hpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -18,6 +18,18 @@
 
 namespace boost{ namespace multiprecision{
 
+namespace detail{
+
+inline void check_tommath_result(unsigned v)
+{
+ if(v != MP_OKAY)
+ {
+ BOOST_THROW_EXCEPTION(std::runtime_error(mp_error_to_string(v)));
+ }
+}
+
+}
+
 struct tommath_int
 {
    typedef mpl::list<long, long long> signed_types;
@@ -26,15 +38,15 @@
 
    tommath_int()
    {
- mp_init(&m_data);
+ detail::check_tommath_result(mp_init(&m_data));
    }
    tommath_int(const tommath_int& o)
    {
- mp_init_copy(&m_data, const_cast<::mp_int*>(&o.m_data));
+ detail::check_tommath_result(mp_init_copy(&m_data, const_cast<::mp_int*>(&o.m_data)));
    }
    tommath_int& operator = (const tommath_int& o)
    {
- mp_copy(const_cast<::mp_int*>(&o.m_data), &m_data);
+ detail::check_tommath_result(mp_copy(const_cast<::mp_int*>(&o.m_data), &m_data));
       return *this;
    }
    tommath_int& operator = (boost::uintmax_t i)
@@ -42,14 +54,14 @@
       boost::uintmax_t mask = ((1uLL << std::numeric_limits<unsigned>::digits) - 1);
       unsigned shift = 0;
       ::mp_int t;
- mp_init(&t);
+ detail::check_tommath_result(mp_init(&t));
       mp_zero(&m_data);
       while(i)
       {
- mp_set_int(&t, static_cast<unsigned>(i & mask));
+ detail::check_tommath_result(mp_set_int(&t, static_cast<unsigned>(i & mask)));
          if(shift)
- mp_mul_2d(&t, shift, &t);
- mp_add(&m_data, &t, &m_data);
+ detail::check_tommath_result(mp_mul_2d(&t, shift, &t));
+ detail::check_tommath_result((mp_add(&m_data, &t, &m_data)));
          shift += std::numeric_limits<unsigned>::digits;
          i >>= std::numeric_limits<unsigned>::digits;
       }
@@ -61,12 +73,12 @@
       bool neg = i < 0;
       *this = static_cast<boost::uintmax_t>(std::abs(i));
       if(neg)
- mp_neg(&m_data, &m_data);
+ detail::check_tommath_result(mp_neg(&m_data, &m_data));
       return *this;
    }
    tommath_int& operator = (unsigned long i)
    {
- mp_set_int(&m_data, i);
+ detail::check_tommath_result((mp_set_int(&m_data, i)));
       return *this;
    }
    tommath_int& operator = (long i)
@@ -74,7 +86,7 @@
       bool neg = i < 0;
       *this = static_cast<unsigned long>(std::abs(i));
       if(neg)
- mp_neg(&m_data, &m_data);
+ detail::check_tommath_result(mp_neg(&m_data, &m_data));
       return *this;
    }
    tommath_int& operator = (long double a)
@@ -84,12 +96,12 @@
       using std::floor;
 
       if (a == 0) {
- mp_set_int(&m_data, 0);
+ detail::check_tommath_result(mp_set_int(&m_data, 0));
          return *this;
       }
 
       if (a == 1) {
- mp_set_int(&m_data, 1);
+ detail::check_tommath_result(mp_set_int(&m_data, 1));
          return *this;
       }
 
@@ -98,9 +110,9 @@
 
       int e;
       long double f, term;
- mp_init_set_int(&m_data, 0u);
+ detail::check_tommath_result(mp_init_set_int(&m_data, 0u));
       ::mp_int t;
- mp_init(&t);
+ detail::check_tommath_result(mp_init(&t));
 
       f = frexp(a, &e);
 
@@ -112,40 +124,73 @@
          f = ldexp(f, shift);
          term = floor(f);
          e -= shift;
- mp_mul_2d(&m_data, shift, &m_data);
+ detail::check_tommath_result(mp_mul_2d(&m_data, shift, &m_data));
          if(term > 0)
          {
- mp_set_int(&t, static_cast<int>(term));
- mp_add(&m_data, &t, &m_data);
+ detail::check_tommath_result(mp_set_int(&t, static_cast<int>(term)));
+ detail::check_tommath_result(mp_add(&m_data, &t, &m_data));
          }
          else
          {
- mp_set_int(&t, static_cast<int>(-term));
- mp_sub(&m_data, &t, &m_data);
+ detail::check_tommath_result(mp_set_int(&t, static_cast<int>(-term)));
+ detail::check_tommath_result(mp_sub(&m_data, &t, &m_data));
          }
          f -= term;
       }
       if(e > 0)
- mp_mul_2d(&m_data, e, &m_data);
+ detail::check_tommath_result(mp_mul_2d(&m_data, e, &m_data));
       else if(e < 0)
       {
          tommath_int t2;
- mp_div_2d(&m_data, -e, &m_data, &t2.data());
+ detail::check_tommath_result(mp_div_2d(&m_data, -e, &m_data, &t2.data()));
       }
       return *this;
    }
    tommath_int& operator = (const char* s)
    {
- mp_read_radix(&m_data, s, 10);
+ std::size_t n = s ? std::strlen(s) : 0;
+ int radix = 10;
+ if(n && (*s == '0'))
+ {
+ if((n > 1) && ((s[1] == 'x') || (s[1] == 'X')))
+ {
+ radix = 16;
+ s +=2;
+ n -= 2;
+ }
+ else
+ {
+ radix = 8;
+ n -= 1;
+ }
+ }
+ if(n)
+ detail::check_tommath_result(mp_read_radix(&m_data, s, 10));
+ else
+ detail::check_tommath_result(mp_set_int(&m_data, 0));
       return *this;
    }
- std::string str(unsigned /*digits*/, bool /*scientific*/)const
+ std::string str(std::streamsize /*digits*/, std::ios_base::fmtflags f)const
    {
+ int base = 10;
+ if((f & std::ios_base::oct) == std::ios_base::oct)
+ base = 8;
+ else if((f & std::ios_base::hex) == std::ios_base::hex)
+ base = 16;
       int s;
- mp_radix_size(const_cast<::mp_int*>(&m_data), 10, &s);
+ detail::check_tommath_result(mp_radix_size(const_cast<::mp_int*>(&m_data), 10, &s));
       boost::scoped_array<char> a(new char[s+1]);
- mp_toradix_n(const_cast<::mp_int*>(&m_data), a.get(), 10, s+1);
- return a.get();
+ detail::check_tommath_result(mp_toradix_n(const_cast<::mp_int*>(&m_data), a.get(), base, s+1));
+ std::string result = a.get();
+ if((base != 10) && (f & std::ios_base::showbase))
+ {
+ int pos = result[0] == '-' ? 1 : 0;
+ const char* pp = base == 8 ? "0" : "0x";
+ result.insert(pos, pp);
+ }
+ if((f & std::ios_base::showpos) && (result[0] != '-'))
+ result.insert(0, 1, '+');
+ return result;
    }
    ~tommath_int()
    {
@@ -164,7 +209,7 @@
    {
       tommath_int d;
       tommath_int t(*this);
- mp_shrink(&t.data());
+ detail::check_tommath_result(mp_shrink(&t.data()));
       d = v;
       return t.compare(d);
    }
@@ -182,114 +227,114 @@
 
 inline void add(tommath_int& t, const tommath_int& o)
 {
- mp_add(&t.data(), const_cast<::mp_int*>(&o.data()), &t.data());
+ detail::check_tommath_result(mp_add(&t.data(), const_cast<::mp_int*>(&o.data()), &t.data()));
 }
 inline void subtract(tommath_int& t, const tommath_int& o)
 {
- mp_sub(&t.data(), const_cast<::mp_int*>(&o.data()), &t.data());
+ detail::check_tommath_result(mp_sub(&t.data(), const_cast<::mp_int*>(&o.data()), &t.data()));
 }
 inline void multiply(tommath_int& t, const tommath_int& o)
 {
- mp_mul(&t.data(), const_cast<::mp_int*>(&o.data()), &t.data());
+ detail::check_tommath_result(mp_mul(&t.data(), const_cast<::mp_int*>(&o.data()), &t.data()));
 }
 inline void divide(tommath_int& t, const tommath_int& o)
 {
    tommath_int temp;
- mp_div(&t.data(), const_cast<::mp_int*>(&o.data()), &t.data(), &temp.data());
+ detail::check_tommath_result(mp_div(&t.data(), const_cast<::mp_int*>(&o.data()), &t.data(), &temp.data()));
 }
 inline void modulus(tommath_int& t, const tommath_int& o)
 {
    bool neg = get_sign(t) < 0;
    bool neg2 = get_sign(o) < 0;
- mp_mod(&t.data(), const_cast<::mp_int*>(&o.data()), &t.data());
+ detail::check_tommath_result(mp_mod(&t.data(), const_cast<::mp_int*>(&o.data()), &t.data()));
    if(neg != neg2)
    {
       t.negate();
- mp_add(&t.data(), const_cast<::mp_int*>(&o.data()), &t.data());
+ detail::check_tommath_result(mp_add(&t.data(), const_cast<::mp_int*>(&o.data()), &t.data()));
       t.negate();
    }
 }
 template <class UI>
 inline void left_shift(tommath_int& t, UI i)
 {
- mp_mul_2d(&t.data(), static_cast<unsigned>(i), &t.data());
+ detail::check_tommath_result(mp_mul_2d(&t.data(), static_cast<unsigned>(i), &t.data()));
 }
 template <class UI>
 inline void right_shift(tommath_int& t, UI i)
 {
    tommath_int d;
- mp_div_2d(&t.data(), static_cast<unsigned>(i), &t.data(), &d.data());
+ detail::check_tommath_result(mp_div_2d(&t.data(), static_cast<unsigned>(i), &t.data(), &d.data()));
 }
 template <class UI>
 inline void left_shift(tommath_int& t, const tommath_int& v, UI i)
 {
- mp_mul_2d(const_cast<::mp_int*>(&v.data()), static_cast<unsigned>(i), &t.data());
+ detail::check_tommath_result(mp_mul_2d(const_cast<::mp_int*>(&v.data()), static_cast<unsigned>(i), &t.data()));
 }
 template <class UI>
 inline void right_shift(tommath_int& t, const tommath_int& v, UI i)
 {
    tommath_int d;
- mp_div_2d(const_cast<::mp_int*>(&v.data()), static_cast<unsigned long>(i), &t.data(), &d.data());
+ detail::check_tommath_result(mp_div_2d(const_cast<::mp_int*>(&v.data()), static_cast<unsigned long>(i), &t.data(), &d.data()));
 }
 
 inline void bitwise_and(tommath_int& result, const tommath_int& v)
 {
- mp_and(&result.data(), const_cast<::mp_int*>(&v.data()), &result.data());
+ detail::check_tommath_result(mp_and(&result.data(), const_cast<::mp_int*>(&v.data()), &result.data()));
 }
 
 inline void bitwise_or(tommath_int& result, const tommath_int& v)
 {
- mp_or(&result.data(), const_cast<::mp_int*>(&v.data()), &result.data());
+ detail::check_tommath_result(mp_or(&result.data(), const_cast<::mp_int*>(&v.data()), &result.data()));
 }
 
 inline void bitwise_xor(tommath_int& result, const tommath_int& v)
 {
- mp_xor(&result.data(), const_cast<::mp_int*>(&v.data()), &result.data());
+ detail::check_tommath_result(mp_xor(&result.data(), const_cast<::mp_int*>(&v.data()), &result.data()));
 }
 
 inline void add(tommath_int& t, const tommath_int& p, const tommath_int& o)
 {
- mp_add(const_cast<::mp_int*>(&p.data()), const_cast<::mp_int*>(&o.data()), &t.data());
+ detail::check_tommath_result(mp_add(const_cast<::mp_int*>(&p.data()), const_cast<::mp_int*>(&o.data()), &t.data()));
 }
 inline void subtract(tommath_int& t, const tommath_int& p, const tommath_int& o)
 {
- mp_sub(const_cast<::mp_int*>(&p.data()), const_cast<::mp_int*>(&o.data()), &t.data());
+ detail::check_tommath_result(mp_sub(const_cast<::mp_int*>(&p.data()), const_cast<::mp_int*>(&o.data()), &t.data()));
 }
 inline void multiply(tommath_int& t, const tommath_int& p, const tommath_int& o)
 {
- mp_mul(const_cast<::mp_int*>(&p.data()), const_cast<::mp_int*>(&o.data()), &t.data());
+ detail::check_tommath_result(mp_mul(const_cast<::mp_int*>(&p.data()), const_cast<::mp_int*>(&o.data()), &t.data()));
 }
 inline void divide(tommath_int& t, const tommath_int& p, const tommath_int& o)
 {
    tommath_int d;
- mp_div(const_cast<::mp_int*>(&p.data()), const_cast<::mp_int*>(&o.data()), &t.data(), &d.data());
+ detail::check_tommath_result(mp_div(const_cast<::mp_int*>(&p.data()), const_cast<::mp_int*>(&o.data()), &t.data(), &d.data()));
 }
 inline void modulus(tommath_int& t, const tommath_int& p, const tommath_int& o)
 {
    bool neg = get_sign(p) < 0;
    bool neg2 = get_sign(o) < 0;
- mp_mod(const_cast<::mp_int*>(&p.data()), const_cast<::mp_int*>(&o.data()), &t.data());
+ detail::check_tommath_result(mp_mod(const_cast<::mp_int*>(&p.data()), const_cast<::mp_int*>(&o.data()), &t.data()));
    if(neg != neg2)
    {
       t.negate();
- mp_add(&t.data(), const_cast<::mp_int*>(&o.data()), &t.data());
+ detail::check_tommath_result(mp_add(&t.data(), const_cast<::mp_int*>(&o.data()), &t.data()));
       t.negate();
    }
 }
 
 inline void bitwise_and(tommath_int& result, const tommath_int& u, const tommath_int& v)
 {
- mp_and(const_cast<::mp_int*>(&u.data()), const_cast<::mp_int*>(&v.data()), &result.data());
+ detail::check_tommath_result(mp_and(const_cast<::mp_int*>(&u.data()), const_cast<::mp_int*>(&v.data()), &result.data()));
 }
 
 inline void bitwise_or(tommath_int& result, const tommath_int& u, const tommath_int& v)
 {
- mp_or(const_cast<::mp_int*>(&u.data()), const_cast<::mp_int*>(&v.data()), &result.data());
+ detail::check_tommath_result(mp_or(const_cast<::mp_int*>(&u.data()), const_cast<::mp_int*>(&v.data()), &result.data()));
 }
 
 inline void bitwise_xor(tommath_int& result, const tommath_int& u, const tommath_int& v)
 {
- mp_xor(const_cast<::mp_int*>(&u.data()), const_cast<::mp_int*>(&v.data()), &result.data());
+ detail::check_tommath_result(mp_xor(const_cast<::mp_int*>(&u.data()), const_cast<::mp_int*>(&v.data()), &result.data()));
 }
 
 inline void complement(tommath_int& result, const tommath_int& u)
@@ -344,7 +389,7 @@
 }
 inline void eval_abs(tommath_int& result, const tommath_int& val)
 {
- mp_abs(const_cast<::mp_int*>(&val.data()), &result.data());
+ detail::check_tommath_result(mp_abs(const_cast<::mp_int*>(&val.data()), &result.data()));
 }
 
 

Modified: sandbox/big_number/libs/multiprecision/test/mp_number_concept_check.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/mp_number_concept_check.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/mp_number_concept_check.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -1,4 +1,3 @@
-
 // Copyright John Maddock 2011.
 // Use, modification and distribution are subject to the
 // Boost Software License, Version 1.0. (See accompanying file
@@ -13,6 +12,7 @@
 #define BOOST_MATH_INSTANTIATE_MINIMUM
 
 #ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
 # pragma warning(disable:4800)
 # pragma warning(disable:4512)
 # pragma warning(disable:4127)

Modified: sandbox/big_number/libs/multiprecision/test/test.hpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test.hpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test.hpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -4,6 +4,7 @@
 
 #include <limits>
 #include <cmath>
+#include <typeinfo>
 
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/current_function.hpp>

Modified: sandbox/big_number/libs/multiprecision/test/test_acos.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_acos.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_acos.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -8,6 +8,10 @@
 // "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
 // in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/array.hpp>
 #include "test.hpp"

Modified: sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -3,6 +3,10 @@
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/math/special_functions/pow.hpp>
 
@@ -382,10 +386,11 @@
 #else
    Num tol = 0;
 #endif
- BOOST_TEST_CLOSE(n1, boost::lexical_cast<target_type>(Real(n1).str(0, boost::is_floating_point<Num>::value)), tol);
- BOOST_TEST_CLOSE(n2, boost::lexical_cast<target_type>(Real(n2).str(0, boost::is_floating_point<Num>::value)), 0);
- BOOST_TEST_CLOSE(n3, boost::lexical_cast<target_type>(Real(n3).str(0, boost::is_floating_point<Num>::value)), 0);
- BOOST_TEST_CLOSE(n4, boost::lexical_cast<target_type>(Real(n4).str(0, boost::is_floating_point<Num>::value)), 0);
+ std::ios_base::fmtflags f = boost::is_floating_point<Num>::value ? std::ios_base::scientific : std::ios_base::fmtflags(0);
+ BOOST_TEST_CLOSE(n1, boost::lexical_cast<target_type>(Real(n1).str(0, f)), tol);
+ BOOST_TEST_CLOSE(n2, boost::lexical_cast<target_type>(Real(n2).str(0, f)), 0);
+ BOOST_TEST_CLOSE(n3, boost::lexical_cast<target_type>(Real(n3).str(0, f)), 0);
+ BOOST_TEST_CLOSE(n4, boost::lexical_cast<target_type>(Real(n4).str(0, f)), 0);
    // Assignment:
    Real r(0);
    BOOST_TEST(r != n1);
@@ -483,10 +488,11 @@
 #else
    Num tol = 0;
 #endif
- BOOST_TEST_CLOSE(n1, boost::lexical_cast<target_type>(Real(n1).str(0, boost::is_floating_point<Num>::value)), tol);
- BOOST_TEST_CLOSE(n2, boost::lexical_cast<target_type>(Real(n2).str(0, boost::is_floating_point<Num>::value)), 0);
- BOOST_TEST_CLOSE(n3, boost::lexical_cast<target_type>(Real(n3).str(0, boost::is_floating_point<Num>::value)), 0);
- BOOST_TEST_CLOSE(n4, boost::lexical_cast<target_type>(Real(n4).str(0, boost::is_floating_point<Num>::value)), 0);
+ std::ios_base::fmtflags f = boost::is_floating_point<Num>::value ? std::ios_base::scientific : std::ios_base::fmtflags(0);
+ BOOST_TEST_CLOSE(n1, boost::lexical_cast<target_type>(Real(n1).str(0, f)), tol);
+ BOOST_TEST_CLOSE(n2, boost::lexical_cast<target_type>(Real(n2).str(0, f)), 0);
+ BOOST_TEST_CLOSE(n3, boost::lexical_cast<target_type>(Real(n3).str(0, f)), 0);
+ BOOST_TEST_CLOSE(n4, boost::lexical_cast<target_type>(Real(n4).str(0, f)), 0);
    // Assignment:
    Real r(0);
    BOOST_TEST(r != n1);

Modified: sandbox/big_number/libs/multiprecision/test/test_asin.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_asin.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_asin.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -8,6 +8,10 @@
 // "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
 // in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/array.hpp>
 #include "test.hpp"

Modified: sandbox/big_number/libs/multiprecision/test/test_atan.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_atan.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_atan.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -8,6 +8,10 @@
 // "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
 // in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/array.hpp>
 #include "test.hpp"

Modified: sandbox/big_number/libs/multiprecision/test/test_cos.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_cos.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_cos.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -8,6 +8,10 @@
 // "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
 // in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/array.hpp>
 #include "test.hpp"

Modified: sandbox/big_number/libs/multiprecision/test/test_cosh.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_cosh.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_cosh.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -8,6 +8,10 @@
 // "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
 // in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/array.hpp>
 #include "test.hpp"

Modified: sandbox/big_number/libs/multiprecision/test/test_exp.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_exp.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_exp.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -8,6 +8,10 @@
 // "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
 // in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/array.hpp>
 #include "test.hpp"

Modified: sandbox/big_number/libs/multiprecision/test/test_fpclassify.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_fpclassify.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_fpclassify.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -4,6 +4,10 @@
 // Boost Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <cmath>
 #include <math.h>
 #include <boost/limits.hpp>

Modified: sandbox/big_number/libs/multiprecision/test/test_gmp_conversions.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_gmp_conversions.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_gmp_conversions.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -8,6 +8,10 @@
 // "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
 // in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/array.hpp>
 #include "test.hpp"

Modified: sandbox/big_number/libs/multiprecision/test/test_log.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_log.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_log.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -8,6 +8,10 @@
 // "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
 // in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/array.hpp>
 #include "test.hpp"

Modified: sandbox/big_number/libs/multiprecision/test/test_mpfr_conversions.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_mpfr_conversions.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_mpfr_conversions.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -8,6 +8,10 @@
 // "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
 // in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/array.hpp>
 #include "test.hpp"

Modified: sandbox/big_number/libs/multiprecision/test/test_numeric_limits.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_numeric_limits.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_numeric_limits.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -3,6 +3,10 @@
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 
 #if !defined(TEST_MPF_50) && !defined(TEST_MPF) && !defined(TEST_BACKEND) && !defined(TEST_MPZ) && !defined(TEST_CPP_FLOAT) && !defined(TEST_MPFR) && !defined(TEST_MPFR_50) && !defined(TEST_MPQ) && !defined(TEST_TOMMATH)

Modified: sandbox/big_number/libs/multiprecision/test/test_pow.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_pow.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_pow.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -8,6 +8,10 @@
 // "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
 // in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/array.hpp>
 #include "test.hpp"

Modified: sandbox/big_number/libs/multiprecision/test/test_round.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_round.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_round.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -3,6 +3,10 @@
 // Boost Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/math/special_functions/round.hpp>
 #include <boost/math/special_functions/trunc.hpp>

Modified: sandbox/big_number/libs/multiprecision/test/test_sin.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_sin.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_sin.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -8,6 +8,10 @@
 // "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
 // in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/array.hpp>
 #include "test.hpp"

Modified: sandbox/big_number/libs/multiprecision/test/test_sinh.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_sinh.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_sinh.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -8,6 +8,10 @@
 // "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
 // in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/array.hpp>
 #include "test.hpp"

Modified: sandbox/big_number/libs/multiprecision/test/test_sqrt.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_sqrt.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_sqrt.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -8,6 +8,10 @@
 // "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
 // in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/array.hpp>
 #include "test.hpp"

Modified: sandbox/big_number/libs/multiprecision/test/test_tanh.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_tanh.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_tanh.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -8,6 +8,10 @@
 // "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
 // in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/array.hpp>
 #include "test.hpp"

Modified: sandbox/big_number/libs/multiprecision/test/test_test.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_test.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_test.cpp 2011-11-21 04:52:32 EST (Mon, 21 Nov 2011)
@@ -3,6 +3,10 @@
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
 
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
 #include "test.hpp"
 #include <boost/multiprecision/cpp_float.hpp>
 


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