|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80058 - in sandbox/big_number: boost/multiprecision boost/multiprecision/concepts boost/multiprecision/detail libs/multiprecision/test libs/multiprecision/test/compile_fail libs/multiprecision/test/math
From: john_at_[hidden]
Date: 2012-08-16 04:14:09
Author: johnmaddock
Date: 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
New Revision: 80058
URL: http://svn.boost.org/trac/boost/changeset/80058
Log:
Big breaking change - make lossy construction explicit.
Added:
sandbox/big_number/libs/multiprecision/test/compile_fail/
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_1.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_10.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_11.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_12.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_13.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_14.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_15.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_16.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_17.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_18.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_19.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_2.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_20.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_21.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_22.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_23.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_24.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_25.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_26.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_27.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_28.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_29.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_3.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_30.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_31.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_32.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_33.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_34.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_35.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_36.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_37.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_38.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_39.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_4.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_40.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_41.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_42.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_43.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_44.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_5.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_6.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_7.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_8.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_9.cpp (contents, props changed)
sandbox/big_number/libs/multiprecision/test/math/table_type.hpp (contents, props changed)
Text files modified:
sandbox/big_number/boost/multiprecision/concepts/mp_number_archetypes.hpp | 7
sandbox/big_number/boost/multiprecision/cpp_dec_float.hpp | 10 +
sandbox/big_number/boost/multiprecision/cpp_int.hpp | 2
sandbox/big_number/boost/multiprecision/detail/integer_ops.hpp | 9 +
sandbox/big_number/boost/multiprecision/detail/no_et_ops.hpp | 60 ++++----
sandbox/big_number/boost/multiprecision/detail/number_base.hpp | 100 ++++++++-----
sandbox/big_number/boost/multiprecision/gmp.hpp | 39 +++--
sandbox/big_number/boost/multiprecision/mpfr.hpp | 23 ++-
sandbox/big_number/boost/multiprecision/number.hpp | 166 ++++++++++++++++------
sandbox/big_number/boost/multiprecision/rational_adapter.hpp | 28 +++
sandbox/big_number/libs/multiprecision/test/Jamfile.v2 | 12 +
sandbox/big_number/libs/multiprecision/test/math/log1p_expm1_test.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/powm1_sqrtp1m1_test.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_bessel_i.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_bessel_j.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_bessel_k.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_bessel_y.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_beta.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_binomial_coeff.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_carlson.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_cbrt.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_digamma.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_ellint_1.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_ellint_2.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_ellint_3.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_erf.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_expint.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_gamma.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_hermite.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_ibeta.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_ibeta_2.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_ibeta_3.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_ibeta_4.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_ibeta_inv_1.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_ibeta_inv_ab_4.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_igamma.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_igamma_inv.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_igamma_inva.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_laguerre.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_legendre.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_tgamma_ratio.cpp | 2
sandbox/big_number/libs/multiprecision/test/math/test_zeta.cpp | 2
sandbox/big_number/libs/multiprecision/test/test_acos.cpp | 30 ++--
sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp | 290 ++++++++++++++++++++++-----------------
sandbox/big_number/libs/multiprecision/test/test_asin.cpp | 12
sandbox/big_number/libs/multiprecision/test/test_atan.cpp | 4
sandbox/big_number/libs/multiprecision/test/test_constants.cpp | 6
sandbox/big_number/libs/multiprecision/test/test_cos.cpp | 22 +-
sandbox/big_number/libs/multiprecision/test/test_cosh.cpp | 2
sandbox/big_number/libs/multiprecision/test/test_cpp_int.cpp | 8
sandbox/big_number/libs/multiprecision/test/test_exp.cpp | 22 +-
sandbox/big_number/libs/multiprecision/test/test_float_io.cpp | 12
sandbox/big_number/libs/multiprecision/test/test_generic_conv.cpp | 12
sandbox/big_number/libs/multiprecision/test/test_gmp_conversions.cpp | 6
sandbox/big_number/libs/multiprecision/test/test_int_io.cpp | 4
sandbox/big_number/libs/multiprecision/test/test_log.cpp | 2
sandbox/big_number/libs/multiprecision/test/test_rational_io.cpp | 14 +
sandbox/big_number/libs/multiprecision/test/test_sin.cpp | 20 +-
sandbox/big_number/libs/multiprecision/test/test_sinh.cpp | 2
sandbox/big_number/libs/multiprecision/test/test_sqrt.cpp | 2
sandbox/big_number/libs/multiprecision/test/test_tanh.cpp | 2
61 files changed, 594 insertions(+), 396 deletions(-)
Modified: sandbox/big_number/boost/multiprecision/concepts/mp_number_archetypes.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/concepts/mp_number_archetypes.hpp (original)
+++ sandbox/big_number/boost/multiprecision/concepts/mp_number_archetypes.hpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -197,7 +197,12 @@
typedef boost::multiprecision::number<mp_number_backend_float_architype> mp_number_float_architype;
-}}} // namespaces
+} // namespace
+
+template<>
+struct number_category<concepts::mp_number_backend_float_architype> : public mpl::int_<number_kind_floating_point>{};
+
+}} // namespaces
namespace std{
Modified: sandbox/big_number/boost/multiprecision/cpp_dec_float.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/cpp_dec_float.hpp (original)
+++ sandbox/big_number/boost/multiprecision/cpp_dec_float.hpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -27,6 +27,16 @@
namespace backends{
template <unsigned Digits10>
+class cpp_dec_float;
+
+} // namespace
+
+template <unsigned Digits10>
+struct number_category<backends::cpp_dec_float<Digits10> > : public mpl::int_<number_kind_floating_point>{};
+
+namespace backends{
+
+template <unsigned Digits10>
class cpp_dec_float
{
private:
Modified: sandbox/big_number/boost/multiprecision/cpp_int.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/cpp_int.hpp (original)
+++ sandbox/big_number/boost/multiprecision/cpp_int.hpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -1943,7 +1943,7 @@
//
if(r_order <= y_order)
{
- if((r_order < y_order) || (r.compare(y) < 0))
+ if((r_order < y_order) || (r.compare_unsigned(y) < 0))
{
return;
}
Modified: sandbox/big_number/boost/multiprecision/detail/integer_ops.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/integer_ops.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/integer_ops.hpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -38,6 +38,11 @@
return maybe_abs(result);
}
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
+
template <class B>
inline void eval_gcd(B& result, const B& a, const B& b)
{
@@ -100,6 +105,10 @@
eval_left_shift(result, shift);
}
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
template <class B>
inline void eval_lcm(B& result, const B& a, const B& b)
{
Modified: sandbox/big_number/boost/multiprecision/detail/no_et_ops.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/no_et_ops.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/no_et_ops.hpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -40,7 +40,7 @@
return BOOST_MP_MOVE(result);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator + (const number<B, false>& a, const V& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -50,7 +50,7 @@
return BOOST_MP_MOVE(result);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator + (const V& a, const number<B, false>& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -71,7 +71,7 @@
return BOOST_MP_MOVE(result);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator - (const number<B, false>& a, const V& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -81,7 +81,7 @@
return BOOST_MP_MOVE(result);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator - (const V& a, const number<B, false>& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -102,7 +102,7 @@
return BOOST_MP_MOVE(result);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator * (const number<B, false>& a, const V& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -112,7 +112,7 @@
return BOOST_MP_MOVE(result);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator * (const V& a, const number<B, false>& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -133,7 +133,7 @@
return BOOST_MP_MOVE(result);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator / (const number<B, false>& a, const V& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -143,7 +143,7 @@
return BOOST_MP_MOVE(result);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator / (const V& a, const number<B, false>& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -164,7 +164,7 @@
return BOOST_MP_MOVE(result);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator % (const number<B, false>& a, const V& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -174,7 +174,7 @@
return BOOST_MP_MOVE(result);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator % (const V& a, const number<B, false>& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -195,7 +195,7 @@
return BOOST_MP_MOVE(result);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator | (const number<B, false>& a, const V& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -205,7 +205,7 @@
return BOOST_MP_MOVE(result);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator | (const V& a, const number<B, false>& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -226,7 +226,7 @@
return BOOST_MP_MOVE(result);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator ^ (const number<B, false>& a, const V& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -236,7 +236,7 @@
return BOOST_MP_MOVE(result);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator ^ (const V& a, const number<B, false>& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -257,7 +257,7 @@
return BOOST_MP_MOVE(result);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator & (const number<B, false>& a, const V& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -267,7 +267,7 @@
return BOOST_MP_MOVE(result);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator & (const V& a, const number<B, false>& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -347,7 +347,7 @@
return static_cast<number<B, false>&&>(a);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator + (number<B, false>&& a, const V& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -356,7 +356,7 @@
return static_cast<number<B, false>&&>(a);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator + (const V& a, number<B, false>&& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -390,7 +390,7 @@
return static_cast<number<B, false>&&>(a);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator - (number<B, false>&& a, const V& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -399,7 +399,7 @@
return static_cast<number<B, false>&&>(a);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator - (const V& a, number<B, false>&& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -433,7 +433,7 @@
return static_cast<number<B, false>&&>(a);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator * (number<B, false>&& a, const V& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -442,7 +442,7 @@
return static_cast<number<B, false>&&>(a);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator * (const V& a, number<B, false>&& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -461,7 +461,7 @@
return static_cast<number<B, false>&&>(a);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator / (number<B, false>&& a, const V& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -480,7 +480,7 @@
return static_cast<number<B, false>&&>(a);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator % (number<B, false>&& a, const V& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -513,7 +513,7 @@
return static_cast<number<B, false>&&>(a);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator | (number<B, false>&& a, const V& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -522,7 +522,7 @@
return static_cast<number<B, false>&&>(a);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator | (const V& a, number<B, false>&& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -555,7 +555,7 @@
return static_cast<number<B, false>&&>(a);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator ^ (number<B, false>&& a, const V& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -564,7 +564,7 @@
return static_cast<number<B, false>&&>(a);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator ^ (const V& a, number<B, false>&& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -597,7 +597,7 @@
return static_cast<number<B, false>&&>(a);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator & (number<B, false>&& a, const V& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
@@ -606,7 +606,7 @@
return static_cast<number<B, false>&&>(a);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, number<B, false> >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, false> >, number<B, false> >::type
operator & (const V& a, number<B, false>&& b)
{
typedef typename detail::canonical<V, B>::type canonical_type;
Modified: sandbox/big_number/boost/multiprecision/detail/number_base.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/number_base.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/number_base.hpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -9,6 +9,7 @@
#include <limits>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_convertible.hpp>
+#include <boost/type_traits/decay.hpp>
#include <boost/lexical_cast.hpp>
namespace boost{ namespace multiprecision{
@@ -36,6 +37,14 @@
template<class tag, class Arg1, class Arg2, class Arg3, class Arg4>
struct is_mp_number_expression<detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > : public mpl::true_ {};
+template <class T, class Num>
+struct is_compatible_arithmetic_type
+ : public mpl::bool_<
+ is_convertible<T, Num>::value
+ && !is_mp_number<T>::value
+ && !is_mp_number_expression<T>::value>
+{};
+
namespace detail{
//
// Workaround for missing abs(long long) on some compilers:
@@ -67,7 +76,7 @@
template <class Val, class Backend, class Tag>
struct canonical_imp
{
- typedef Val type;
+ typedef typename decay<Val>::type type;
};
template <class Val, class Backend>
struct canonical_imp<Val, Backend, mpl::int_<0> >
@@ -604,13 +613,13 @@
return detail::expression<detail::add_immediates, number<B, true>, number<B, true> >(a, b);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::add_immediates, number<B, true>, V > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::add_immediates, number<B, true>, V > >::type
operator + (const number<B, true>& a, const V& b)
{
return detail::expression<detail::add_immediates, number<B, true>, V >(a, b);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::add_immediates, V, number<B, true> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::add_immediates, V, number<B, true> > >::type
operator + (const V& a, const number<B, true>& b)
{
return detail::expression<detail::add_immediates, V, number<B, true> >(a, b);
@@ -634,13 +643,13 @@
return detail::expression<detail::plus, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, detail::expression<tag2, Arg1b, Arg2b, Arg3b, Arg4b> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::plus, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>, detail::expression<detail::plus, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V > >::type
operator + (const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& a, const V& b)
{
return detail::expression<detail::plus, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V >(a, b);
}
template <class V, class tag, class Arg1, class Arg2, class Arg3, class Arg4>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::plus, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>, detail::expression<detail::plus, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > >::type
operator + (const V& a, const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& b)
{
return detail::expression<detail::plus, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> >(a, b);
@@ -673,17 +682,23 @@
return detail::expression<detail::subtract_immediates, number<B, true>, number<B, true> >(b, a.left_ref());
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::subtract_immediates, V, number<B, true> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::subtract_immediates, V, number<B, true> > >::type
operator + (const detail::expression<detail::negate, number<B, true> >& a, const V& b)
{
return detail::expression<detail::subtract_immediates, V, number<B, true> >(b, a.left_ref());
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::subtract_immediates, V, number<B, true> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::subtract_immediates, V, number<B, true> > >::type
operator + (const V& a, const detail::expression<detail::negate, number<B, true> >& b)
{
return detail::expression<detail::subtract_immediates, number<B, true>, number<B, true> >(a, b.left_ref());
}
+template <class B>
+inline detail::expression<detail::negate, detail::expression<detail::add_immediates, number<B, true>, number<B, true> > >
+ operator + (const detail::expression<detail::negate, number<B, true> >& a, const detail::expression<detail::negate, number<B, true> >& b)
+{
+ return detail::expression<detail::negate, detail::expression<detail::add_immediates, number<B, true>, number<B, true> > >(detail::expression<detail::add_immediates, number<B, true>, number<B, true> >(a.left_ref(), b.left_ref()));
+}
//
// Subtraction:
//
@@ -694,13 +709,13 @@
return detail::expression<detail::subtract_immediates, number<B, true>, number<B, true> >(a, b);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::subtract_immediates, number<B, true>, V > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::subtract_immediates, number<B, true>, V > >::type
operator - (const number<B, true>& a, const V& b)
{
return detail::expression<detail::subtract_immediates, number<B, true>, V >(a, b);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::subtract_immediates, V, number<B, true> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::subtract_immediates, V, number<B, true> > >::type
operator - (const V& a, const number<B, true>& b)
{
return detail::expression<detail::subtract_immediates, V, number<B, true> >(a, b);
@@ -724,13 +739,13 @@
return detail::expression<detail::minus, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, detail::expression<tag2, Arg1b, Arg2b, Arg3b, Arg4b> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::minus, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>, detail::expression<detail::minus, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V > >::type
operator - (const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& a, const V& b)
{
return detail::expression<detail::minus, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V >(a, b);
}
template <class V, class tag, class Arg1, class Arg2, class Arg3, class Arg4>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::minus, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>, detail::expression<detail::minus, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > >::type
operator - (const V& a, const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& b)
{
return detail::expression<detail::minus, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> >(a, b);
@@ -765,13 +780,13 @@
detail::expression<detail::add_immediates, number<B, true>, number<B, true> >(b, a.left_ref()));
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::negate, detail::expression<detail::add_immediates, number<B, true>, V > > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::negate, detail::expression<detail::add_immediates, number<B, true>, V > > >::type
operator - (const detail::expression<detail::negate, number<B, true> >& a, const V& b)
{
return detail::expression<detail::negate, detail::expression<detail::add_immediates, number<B, true>, V > >(detail::expression<detail::add_immediates, number<B, true>, V >(a.left_ref(), b));
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::add_immediates, V, number<B, true> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::add_immediates, V, number<B, true> > >::type
operator - (const V& a, const detail::expression<detail::negate, number<B, true> >& b)
{
return detail::expression<detail::add_immediates, V, number<B, true> >(a, b.left_ref());
@@ -786,13 +801,13 @@
return detail::expression<detail::multiply_immediates, number<B, true>, number<B, true> >(a, b);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::multiply_immediates, number<B, true>, V > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::multiply_immediates, number<B, true>, V > >::type
operator * (const number<B, true>& a, const V& b)
{
return detail::expression<detail::multiply_immediates, number<B, true>, V >(a, b);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::multiply_immediates, V, number<B, true> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::multiply_immediates, V, number<B, true> > >::type
operator * (const V& a, const number<B, true>& b)
{
return detail::expression<detail::multiply_immediates, V, number<B, true> >(a, b);
@@ -816,13 +831,13 @@
return detail::expression<detail::multiplies, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, detail::expression<tag2, Arg1b, Arg2b, Arg3b, Arg4b> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::multiplies, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>, detail::expression<detail::multiplies, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V > >::type
operator * (const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& a, const V& b)
{
return detail::expression<detail::multiplies, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V >(a, b);
}
template <class V, class tag, class Arg1, class Arg2, class Arg3, class Arg4>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::multiplies, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>, detail::expression<detail::multiplies, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > >::type
operator * (const V& a, const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& b)
{
return detail::expression<detail::multiplies, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> >(a, b);
@@ -859,14 +874,14 @@
detail::expression<detail::multiply_immediates, number<B, true>, number<B, true> >(b, a.left_ref()));
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::negate, detail::expression<detail::multiply_immediates, number<B, true>, V > > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::negate, detail::expression<detail::multiply_immediates, number<B, true>, V > > >::type
operator * (const detail::expression<detail::negate, number<B, true> >& a, const V& b)
{
return detail::expression<detail::negate, detail::expression<detail::multiply_immediates, number<B, true>, V > > (
detail::expression<detail::multiply_immediates, number<B, true>, V >(a.left_ref(), b));
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::negate, detail::expression<detail::multiply_immediates, number<B, true>, V > > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::negate, detail::expression<detail::multiply_immediates, number<B, true>, V > > >::type
operator * (const V& a, const detail::expression<detail::negate, number<B, true> >& b)
{
return detail::expression<detail::negate, detail::expression<detail::multiply_immediates, number<B, true>, V > >(
@@ -882,13 +897,13 @@
return detail::expression<detail::divide_immediates, number<B, true>, number<B, true> >(a, b);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::divide_immediates, number<B, true>, V > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::divide_immediates, number<B, true>, V > >::type
operator / (const number<B, true>& a, const V& b)
{
return detail::expression<detail::divide_immediates, number<B, true>, V >(a, b);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::divide_immediates, V, number<B, true> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::divide_immediates, V, number<B, true> > >::type
operator / (const V& a, const number<B, true>& b)
{
return detail::expression<detail::divide_immediates, V, number<B, true> >(a, b);
@@ -912,13 +927,13 @@
return detail::expression<detail::divides, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, detail::expression<tag2, Arg1b, Arg2b, Arg3b, Arg4b> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::divides, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>, detail::expression<detail::divides, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V > >::type
operator / (const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& a, const V& b)
{
return detail::expression<detail::divides, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V >(a, b);
}
template <class V, class tag, class Arg1, class Arg2, class Arg3, class Arg4>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::divides, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>, detail::expression<detail::divides, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > >::type
operator / (const V& a, const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& b)
{
return detail::expression<detail::divides, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> >(a, b);
@@ -955,14 +970,14 @@
detail::expression<detail::divide_immediates, number<B, true>, number<B, true> >(a.left_ref(), b));
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::negate, detail::expression<detail::divide_immediates, number<B, true>, V > > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::negate, detail::expression<detail::divide_immediates, number<B, true>, V > > >::type
operator / (const detail::expression<detail::negate, number<B, true> >& a, const V& b)
{
return detail::expression<detail::negate, detail::expression<detail::divide_immediates, number<B, true>, V > >(
detail::expression<detail::divide_immediates, number<B, true>, V>(a.left_ref(), b));
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::negate, detail::expression<detail::divide_immediates, V, number<B, true> > > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::negate, detail::expression<detail::divide_immediates, V, number<B, true> > > >::type
operator / (const V& a, const detail::expression<detail::negate, number<B, true> >& b)
{
return detail::expression<detail::negate, detail::expression<detail::divide_immediates, V, number<B, true> > >(
@@ -978,13 +993,13 @@
return detail::expression<detail::modulus_immediates, number<B, true>, number<B, true> >(a, b);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::modulus_immediates, number<B, true>, V > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::modulus_immediates, number<B, true>, V > >::type
operator % (const number<B, true>& a, const V& b)
{
return detail::expression<detail::modulus_immediates, number<B, true>, V >(a, b);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::modulus_immediates, V, number<B, true> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::modulus_immediates, V, number<B, true> > >::type
operator % (const V& a, const number<B, true>& b)
{
return detail::expression<detail::modulus_immediates, V, number<B, true> >(a, b);
@@ -1008,13 +1023,13 @@
return detail::expression<detail::modulus, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, detail::expression<tag2, Arg1b, Arg2b, Arg3b, Arg4b> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::modulus, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>, detail::expression<detail::modulus, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V > >::type
operator % (const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& a, const V& b)
{
return detail::expression<detail::modulus, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V >(a, b);
}
template <class V, class tag, class Arg1, class Arg2, class Arg3, class Arg4>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::modulus, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>, detail::expression<detail::modulus, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > >::type
operator % (const V& a, const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& b)
{
return detail::expression<detail::modulus, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> >(a, b);
@@ -1059,13 +1074,13 @@
return detail::expression<detail::bitwise_and_immediates, number<B, true>, number<B, true> >(a, b);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::bitwise_and_immediates, number<B, true>, V > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::bitwise_and_immediates, number<B, true>, V > >::type
operator & (const number<B, true>& a, const V& b)
{
return detail::expression<detail::bitwise_and_immediates, number<B, true>, V >(a, b);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::bitwise_and_immediates, V, number<B, true> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::bitwise_and_immediates, V, number<B, true> > >::type
operator & (const V& a, const number<B, true>& b)
{
return detail::expression<detail::bitwise_and_immediates, V, number<B, true> >(a, b);
@@ -1089,13 +1104,13 @@
return detail::expression<detail::bitwise_and, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, detail::expression<tag2, Arg1b, Arg2b, Arg3b, Arg4b> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::bitwise_and, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>, detail::expression<detail::bitwise_and, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V > >::type
operator & (const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& a, const V& b)
{
return detail::expression<detail::bitwise_and, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V >(a, b);
}
template <class V, class tag, class Arg1, class Arg2, class Arg3, class Arg4>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::bitwise_and, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>, detail::expression<detail::bitwise_and, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > >::type
operator & (const V& a, const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& b)
{
return detail::expression<detail::bitwise_and, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> >(a, b);
@@ -1110,13 +1125,13 @@
return detail::expression<detail::bitwise_or_immediates, number<B, true>, number<B, true> >(a, b);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::bitwise_or_immediates, number<B, true>, V > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::bitwise_or_immediates, number<B, true>, V > >::type
operator| (const number<B, true>& a, const V& b)
{
return detail::expression<detail::bitwise_or_immediates, number<B, true>, V >(a, b);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::bitwise_or_immediates, V, number<B, true> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::bitwise_or_immediates, V, number<B, true> > >::type
operator| (const V& a, const number<B, true>& b)
{
return detail::expression<detail::bitwise_or_immediates, V, number<B, true> >(a, b);
@@ -1140,13 +1155,13 @@
return detail::expression<detail::bitwise_or, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, detail::expression<tag2, Arg1b, Arg2b, Arg3b, Arg4b> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::bitwise_or, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>, detail::expression<detail::bitwise_or, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V > >::type
operator| (const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& a, const V& b)
{
return detail::expression<detail::bitwise_or, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V >(a, b);
}
template <class V, class tag, class Arg1, class Arg2, class Arg3, class Arg4>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::bitwise_or, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>, detail::expression<detail::bitwise_or, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > >::type
operator| (const V& a, const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& b)
{
return detail::expression<detail::bitwise_or, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> >(a, b);
@@ -1161,13 +1176,13 @@
return detail::expression<detail::bitwise_xor_immediates, number<B, true>, number<B, true> >(a, b);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::bitwise_xor_immediates, number<B, true>, V > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::bitwise_xor_immediates, number<B, true>, V > >::type
operator^ (const number<B, true>& a, const V& b)
{
return detail::expression<detail::bitwise_xor_immediates, number<B, true>, V >(a, b);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::bitwise_xor_immediates, V, number<B, true> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, number<B, true> >, detail::expression<detail::bitwise_xor_immediates, V, number<B, true> > >::type
operator^ (const V& a, const number<B, true>& b)
{
return detail::expression<detail::bitwise_xor_immediates, V, number<B, true> >(a, b);
@@ -1191,13 +1206,13 @@
return detail::expression<detail::bitwise_xor, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, detail::expression<tag2, Arg1b, Arg2b, Arg3b, Arg4b> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4, class V>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::bitwise_xor, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>, detail::expression<detail::bitwise_xor, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V > >::type
operator^ (const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& a, const V& b)
{
return detail::expression<detail::bitwise_xor, detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, V >(a, b);
}
template <class V, class tag, class Arg1, class Arg2, class Arg3, class Arg4>
-inline typename enable_if<is_arithmetic<V>, detail::expression<detail::bitwise_xor, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > >::type
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>, detail::expression<detail::bitwise_xor, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > >::type
operator^ (const V& a, const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& b)
{
return detail::expression<detail::bitwise_xor, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> >(a, b);
@@ -1208,6 +1223,7 @@
//
enum number_category_type
{
+ number_kind_unknown = -1,
number_kind_integer = 0,
number_kind_floating_point = 1,
number_kind_rational = 2,
@@ -1215,7 +1231,7 @@
};
template <class Num>
-struct number_category : public mpl::int_<number_kind_floating_point> {};
+struct number_category : public mpl::int_<std::numeric_limits<Num>::is_integer ? number_kind_integer : (std::numeric_limits<Num>::max_exponent ? number_kind_floating_point : number_kind_unknown)> {};
template <class Backend, bool ExpressionTemplates>
struct number_category<number<Backend, ExpressionTemplates> > : public number_category<Backend>{};
template <class tag, class A1, class A2, class A3, class A4>
Modified: sandbox/big_number/boost/multiprecision/gmp.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/gmp.hpp (original)
+++ sandbox/big_number/boost/multiprecision/gmp.hpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -29,7 +29,19 @@
template <unsigned digits10>
struct gmp_float;
+struct gmp_int;
+struct gmp_rational;
+
+} // namespace backends
+
+template<>
+struct number_category<backends::gmp_int> : public mpl::int_<number_kind_integer>{};
+template<>
+struct number_category<backends::gmp_rational> : public mpl::int_<number_kind_rational>{};
+template <unsigned digits10>
+struct number_category<backends::gmp_float<digits10> > : public mpl::int_<number_kind_floating_point>{};
+namespace backends{
//
// Within this file, the only functions we mark as noexcept are those that manipulate
// (but don't create) an mpf_t. All other types may allocate at pretty much any time
@@ -394,21 +406,21 @@
gmp_float& operator=(const gmp_float<D>& o);
gmp_float& operator=(const gmp_int& o);
gmp_float& operator=(const gmp_rational& o);
- gmp_float& operator=(const mpf_t& val) BOOST_NOEXCEPT
+ gmp_float& operator=(const mpf_t val) BOOST_NOEXCEPT
{
if(this->m_data[0]._mp_d == 0)
mpf_init2(this->m_data, ((digits10 + 1) * 1000L) / 301L);
mpf_set(this->m_data, val);
return *this;
}
- gmp_float& operator=(const mpz_t& val) BOOST_NOEXCEPT
+ gmp_float& operator=(const mpz_t val) BOOST_NOEXCEPT
{
if(this->m_data[0]._mp_d == 0)
mpf_init2(this->m_data, ((digits10 + 1) * 1000L) / 301L);
mpf_set_z(this->m_data, val);
return *this;
}
- gmp_float& operator=(const mpq_t& val) BOOST_NOEXCEPT
+ gmp_float& operator=(const mpq_t val) BOOST_NOEXCEPT
{
if(this->m_data[0]._mp_d == 0)
mpf_init2(this->m_data, ((digits10 + 1) * 1000L) / 301L);
@@ -485,21 +497,21 @@
}
gmp_float& operator=(const gmp_int& o);
gmp_float& operator=(const gmp_rational& o);
- gmp_float& operator=(const mpf_t& val)
+ gmp_float& operator=(const mpf_t val)
{
if(this->m_data[0]._mp_d == 0)
mpf_init2(this->m_data, ((get_default_precision() + 1) * 1000L) / 301L);
mpf_set(this->m_data, val);
return *this;
}
- gmp_float& operator=(const mpz_t& val)
+ gmp_float& operator=(const mpz_t val)
{
if(this->m_data[0]._mp_d == 0)
mpf_init2(this->m_data, ((get_default_precision() + 1) * 1000L) / 301L);
mpf_set_z(this->m_data, val);
return *this;
}
- gmp_float& operator=(const mpq_t& val)
+ gmp_float& operator=(const mpq_t val)
{
if(this->m_data[0]._mp_d == 0)
mpf_init2(this->m_data, ((get_default_precision() + 1) * 1000L) / 301L);
@@ -1130,21 +1142,21 @@
mpz_set_ui(m_data, 0);
return *this;
}
- gmp_int& operator=(const mpf_t& val)
+ gmp_int& operator=(const mpf_t val)
{
if(m_data[0]._mp_d == 0)
mpz_init(this->m_data);
mpz_set_f(this->m_data, val);
return *this;
}
- gmp_int& operator=(const mpz_t& val)
+ gmp_int& operator=(const mpz_t val)
{
if(m_data[0]._mp_d == 0)
mpz_init(this->m_data);
mpz_set(this->m_data, val);
return *this;
}
- gmp_int& operator=(const mpq_t& val)
+ gmp_int& operator=(const mpq_t val)
{
if(m_data[0]._mp_d == 0)
mpz_init(this->m_data);
@@ -1789,14 +1801,14 @@
mpq_set_z(m_data, o.data());
return *this;
}
- gmp_rational& operator=(const mpq_t& o)
+ gmp_rational& operator=(const mpq_t o)
{
if(m_data[0]._mp_den._mp_d == 0)
mpq_init(m_data);
mpq_set(m_data, o);
return *this;
}
- gmp_rational& operator=(const mpz_t& o)
+ gmp_rational& operator=(const mpz_t o)
{
if(m_data[0]._mp_den._mp_d == 0)
mpq_init(m_data);
@@ -2077,11 +2089,6 @@
typedef number<gmp_int> type;
};
-template<>
-struct number_category<gmp_int> : public mpl::int_<number_kind_integer>{};
-template<>
-struct number_category<gmp_rational> : public mpl::int_<number_kind_rational>{};
-
typedef number<gmp_float<50> > mpf_float_50;
typedef number<gmp_float<100> > mpf_float_100;
typedef number<gmp_float<500> > mpf_float_500;
Modified: sandbox/big_number/boost/multiprecision/mpfr.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/mpfr.hpp (original)
+++ sandbox/big_number/boost/multiprecision/mpfr.hpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -23,6 +23,13 @@
template <unsigned digits10>
struct mpfr_float_backend;
+} // namespace backends
+
+template <unsigned digits10>
+struct number_category<backends::mpfr_float_backend<digits10> > : public mpl::int_<number_kind_floating_point>{};
+
+namespace backends{
+
namespace detail{
inline long get_default_precision() { return 50; }
@@ -387,22 +394,22 @@
*static_cast<detail::mpfr_float_imp<digits10>*>(this) = v;
return *this;
}
- mpfr_float_backend& operator=(const mpfr_t& val)BOOST_NOEXCEPT
+ mpfr_float_backend& operator=(const mpfr_t val)BOOST_NOEXCEPT
{
mpfr_set(this->m_data, val, GMP_RNDN);
return *this;
}
- mpfr_float_backend& operator=(const mpf_t& val)BOOST_NOEXCEPT
+ mpfr_float_backend& operator=(const mpf_t val)BOOST_NOEXCEPT
{
mpfr_set_f(this->m_data, val, GMP_RNDN);
return *this;
}
- mpfr_float_backend& operator=(const mpz_t& val)BOOST_NOEXCEPT
+ mpfr_float_backend& operator=(const mpz_t val)BOOST_NOEXCEPT
{
mpfr_set_z(this->m_data, val, GMP_RNDN);
return *this;
}
- mpfr_float_backend& operator=(const mpq_t& val)BOOST_NOEXCEPT
+ mpfr_float_backend& operator=(const mpq_t val)BOOST_NOEXCEPT
{
mpfr_set_q(this->m_data, val, GMP_RNDN);
return *this;
@@ -508,22 +515,22 @@
*static_cast<detail::mpfr_float_imp<0>*>(this) = v;
return *this;
}
- mpfr_float_backend& operator=(const mpfr_t& val) BOOST_NOEXCEPT
+ mpfr_float_backend& operator=(const mpfr_t val) BOOST_NOEXCEPT
{
mpfr_set(this->m_data, val, GMP_RNDN);
return *this;
}
- mpfr_float_backend& operator=(const mpf_t& val) BOOST_NOEXCEPT
+ mpfr_float_backend& operator=(const mpf_t val) BOOST_NOEXCEPT
{
mpfr_set_f(this->m_data, val, GMP_RNDN);
return *this;
}
- mpfr_float_backend& operator=(const mpz_t& val) BOOST_NOEXCEPT
+ mpfr_float_backend& operator=(const mpz_t val) BOOST_NOEXCEPT
{
mpfr_set_z(this->m_data, val, GMP_RNDN);
return *this;
}
- mpfr_float_backend& operator=(const mpq_t& val) BOOST_NOEXCEPT
+ mpfr_float_backend& operator=(const mpq_t val) BOOST_NOEXCEPT
{
mpfr_set_q(this->m_data, val, GMP_RNDN);
return *this;
Modified: sandbox/big_number/boost/multiprecision/number.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/number.hpp (original)
+++ sandbox/big_number/boost/multiprecision/number.hpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -21,6 +21,7 @@
#include <boost/throw_exception.hpp>
#include <boost/multiprecision/detail/generic_interconvert.hpp>
#include <boost/multiprecision/detail/number_compare.hpp>
+#include <boost/multiprecision/traits/is_restricted_conversion.hpp>
#include <istream> // stream operators
#include <cstdio> // EOF
@@ -43,18 +44,38 @@
BOOST_FORCEINLINE BOOST_CONSTEXPR number(const number& e) BOOST_NOEXCEPT_IF(noexcept(Backend(static_cast<const Backend&>(std::declval<Backend>())))) : m_backend(e.m_backend){}
template <class V>
BOOST_FORCEINLINE number(V v, typename enable_if_c<
- (boost::is_arithmetic<V>::value || is_same<std::string, V>::value || is_convertible<V, const char*>::value)
- && !is_convertible<typename detail::canonical<V, Backend>::type, Backend>::value >::type* = 0)
+ (boost::is_arithmetic<V>::value || is_same<std::string, V>::value || is_convertible<V, const char*>::value)
+ && !is_convertible<typename detail::canonical<V, Backend>::type, Backend>::value
+ && !detail::is_restricted_conversion<typename detail::canonical<V, Backend>::type, Backend>::value
+ >::type* = 0)
{
m_backend = canonical_value(v);
}
template <class V>
BOOST_FORCEINLINE BOOST_CONSTEXPR number(V v, typename enable_if_c<
- (boost::is_arithmetic<V>::value || is_same<std::string, V>::value || is_convertible<V, const char*>::value)
- && is_convertible<typename detail::canonical<V, Backend>::type, Backend>::value >::type* = 0)
+ (boost::is_arithmetic<V>::value || is_same<std::string, V>::value || is_convertible<V, const char*>::value)
+ && is_convertible<typename detail::canonical<V, Backend>::type, Backend>::value
+ && !detail::is_restricted_conversion<typename detail::canonical<V, Backend>::type, Backend>::value
+ >::type* = 0)
: m_backend(canonical_value(v)) {}
BOOST_FORCEINLINE BOOST_CONSTEXPR number(const number& e, unsigned digits10)
: m_backend(e.m_backend, digits10){}
+ template <class V>
+ explicit BOOST_FORCEINLINE number(V v, typename enable_if_c<
+ (boost::is_arithmetic<V>::value || is_same<std::string, V>::value || is_convertible<V, const char*>::value)
+ && !is_convertible<typename detail::canonical<V, Backend>::type, Backend>::value
+ && detail::is_restricted_conversion<typename detail::canonical<V, Backend>::type, Backend>::value
+ >::type* = 0)
+ {
+ m_backend = canonical_value(v);
+ }
+ template <class V>
+ explicit BOOST_FORCEINLINE BOOST_CONSTEXPR number(V v, typename enable_if_c<
+ (boost::is_arithmetic<V>::value || is_same<std::string, V>::value || is_convertible<V, const char*>::value)
+ && is_convertible<typename detail::canonical<V, Backend>::type, Backend>::value
+ && detail::is_restricted_conversion<typename detail::canonical<V, Backend>::type, Backend>::value
+ >::type* = 0)
+ : m_backend(canonical_value(v)) {}
/*
//
// This conflicts with component based initialization (for rational and complex types)
@@ -71,12 +92,25 @@
BOOST_FORCEINLINE BOOST_CONSTEXPR number(const number<Backend, ET>& val) BOOST_NOEXCEPT_IF(noexcept(Backend(static_cast<const Backend&>(std::declval<Backend>())))) : m_backend(val.m_backend) {}
template <class Other, bool ET>
- BOOST_FORCEINLINE number(const number<Other, ET>& val, typename enable_if<boost::is_convertible<Other, Backend> >::type* = 0) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = std::declval<Other>()))
+ BOOST_FORCEINLINE number(const number<Other, ET>& val, typename enable_if_c<(boost::is_convertible<Other, Backend>::value && !detail::is_restricted_conversion<Other, Backend>::value)>::type* = 0) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = std::declval<Other>()))
+ {
+ m_backend = val.backend();
+ }
+ template <class Other, bool ET>
+ number(const number<Other, ET>& val, typename enable_if_c<(!boost::is_convertible<Other, Backend>::value && !detail::is_restricted_conversion<Other, Backend>::value)>::type* = 0)
+ {
+ //
+ // Attempt a generic interconvertion:
+ //
+ detail::generic_interconvert(backend(), val.backend(), number_category<Backend>(), number_category<Other>());
+ }
+ template <class Other, bool ET>
+ explicit BOOST_FORCEINLINE number(const number<Other, ET>& val, typename enable_if_c<(boost::is_convertible<Other, Backend>::value && detail::is_restricted_conversion<Other, Backend>::value)>::type* = 0) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = std::declval<Other>()))
{
m_backend = val.backend();
}
template <class Other, bool ET>
- number(const number<Other, ET>& val, typename disable_if<boost::is_convertible<Other, Backend> >::type* = 0)
+ explicit number(const number<Other, ET>& val, typename enable_if_c<(!boost::is_convertible<Other, Backend>::value && detail::is_restricted_conversion<Other, Backend>::value)>::type* = 0)
{
//
// Attempt a generic interconvertion:
@@ -102,27 +136,40 @@
: m_backend(v){}
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
- number& operator=(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
+ typename enable_if<is_convertible<typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type, self_type>, number&>::type operator=(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
{
typedef typename is_same<number, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>::type tag_type;
do_assign(e, tag_type());
return *this;
}
-
+ template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
+ number& assign(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
+ {
+ typedef typename is_same<number, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>::type tag_type;
+ do_assign(e, tag_type());
+ return *this;
+ }
+/*
BOOST_FORCEINLINE number& operator=(const number& e) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = static_cast<const Backend&>(std::declval<Backend>())))
{
m_backend = e.m_backend;
return *this;
}
-
+ */
template <class V>
- BOOST_FORCEINLINE typename enable_if<mpl::or_<boost::is_arithmetic<V>, is_same<std::string, V>, is_convertible<V, const char*> >, number<Backend, ExpressionTemplates>& >::type
+ BOOST_FORCEINLINE typename enable_if<is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
operator=(const V& v) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = std::declval<typename boost::multiprecision::detail::canonical<V, Backend>::type>()))
{
m_backend = canonical_value(v);
return *this;
}
-
+ template <class V>
+ BOOST_FORCEINLINE number<Backend, ExpressionTemplates>& assign(const V& v) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = std::declval<typename boost::multiprecision::detail::canonical<V, Backend>::type>()))
+ {
+ m_backend = canonical_value(v);
+ return *this;
+ }
+ /*
template <class V>
BOOST_FORCEINLINE typename enable_if<mpl::and_<is_convertible<V, Backend>, mpl::not_<mpl::or_<boost::is_arithmetic<V>, is_same<std::string, V>, is_convertible<V, const char*> > > >, number<Backend, ExpressionTemplates>& >::type
operator=(const V& v) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = static_cast<const V&>(std::declval<V>())))
@@ -130,7 +177,6 @@
m_backend = v;
return *this;
}
-
template <bool ET>
BOOST_FORCEINLINE number& operator=(const number<Backend, ET>& v) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = static_cast<const Backend&>(std::declval<Backend>())))
{
@@ -145,6 +191,14 @@
m_backend = v.backend();
return *this;
}
+ template <class Other>
+ BOOST_FORCEINLINE typename enable_if<is_convertible<Other, Backend>, number<Backend, ExpressionTemplates>& >::type
+ assign(const number<Other>& v) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = static_cast<const Other&>(std::declval<Other>())))
+ {
+ m_backend = v.backend();
+ return *this;
+ }
+ */
template <class Other>
typename disable_if<is_convertible<Other, Backend>, number<Backend, ExpressionTemplates>& >::type
@@ -156,9 +210,19 @@
detail::generic_interconvert(backend(), v.backend(), number_category<Backend>(), number_category<Other>());
return *this;
}
+ template <class Other>
+ typename disable_if<is_convertible<Other, Backend>, number<Backend, ExpressionTemplates>& >::type
+ assign(const number<Other>& v)
+ {
+ //
+ // Attempt a generic interconvertion:
+ //
+ detail::generic_interconvert(backend(), v.backend(), number_category<Backend>(), number_category<Other>());
+ return *this;
+ }
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
- number(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
+ number(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e, typename enable_if_c<is_convertible<typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type, self_type>::value>::type* = 0)
{
*this = e;
}
@@ -196,7 +260,7 @@
}
template <class V>
- typename enable_if<boost::is_arithmetic<V>, number<Backend, ExpressionTemplates>& >::type
+ typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
operator+=(const V& v)
{
using default_ops::eval_add;
@@ -210,24 +274,24 @@
return *this;
}
- template <class Exp>
- number& operator-=(const detail::expression<Exp>& e)
+ template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
+ number& operator-=(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
{
// Create a copy if e contains this:
if(contains_self(e))
{
self_type temp(e);
- do_subtract(temp, detail::terminal());
+ do_subtract(detail::expression<detail::terminal, self_type>(temp), detail::terminal());
}
else
{
- do_subtract(e, typename Exp::tag_type());
+ do_subtract(e, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::tag_type());
}
return *this;
}
template <class V>
- typename enable_if<boost::is_arithmetic<V>, number<Backend, ExpressionTemplates>& >::type
+ typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
operator-=(const V& v)
{
using default_ops::eval_subtract;
@@ -242,8 +306,8 @@
return *this;
}
- template <class Exp>
- number& operator*=(const detail::expression<Exp>& e)
+ template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
+ number& operator*=(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
{
// Create a temporary if the RHS references *this, but not
// if we're just doing an x *= x;
@@ -254,13 +318,13 @@
}
else
{
- do_multiplies(e, typename Exp::tag_type());
+ do_multiplies(e, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::tag_type());
}
return *this;
}
template <class V>
- typename enable_if<boost::is_arithmetic<V>, number<Backend, ExpressionTemplates>& >::type
+ typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
operator*=(const V& v)
{
using default_ops::eval_multiply;
@@ -274,24 +338,24 @@
do_modulus(detail::expression<detail::terminal, self_type>(e), detail::terminal());
return *this;
}
- template <class Exp>
- number& operator%=(const detail::expression<Exp>& e)
+ template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
+ number& operator%=(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
{
BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The modulus operation is only valid for integer types");
// Create a temporary if the RHS references *this:
if(contains_self(e))
{
self_type temp(e);
- do_modulus(temp, detail::terminal());
+ do_modulus(detail::expression<detail::terminal, self_type>(temp), detail::terminal());
}
else
{
- do_modulus(e, typename Exp::tag_type());
+ do_modulus(e, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::tag_type());
}
return *this;
}
template <class V>
- typename enable_if<boost::is_arithmetic<V>, number<Backend, ExpressionTemplates>& >::type
+ typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
operator%=(const V& v)
{
BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The modulus operation is only valid for integer types");
@@ -362,8 +426,8 @@
return *this;
}
- template <class Exp>
- number& operator/=(const detail::expression<Exp>& e)
+ template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
+ number& operator/=(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
{
// Create a temporary if the RHS references *this:
if(contains_self(e))
@@ -373,13 +437,13 @@
}
else
{
- do_divide(e, typename Exp::tag_type());
+ do_divide(e, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::tag_type());
}
return *this;
}
template <class V>
- BOOST_FORCEINLINE typename enable_if<boost::is_arithmetic<V>, number<Backend, ExpressionTemplates>& >::type
+ BOOST_FORCEINLINE typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
operator/=(const V& v)
{
using default_ops::eval_divide;
@@ -394,8 +458,8 @@
return *this;
}
- template <class Exp>
- number& operator&=(const detail::expression<Exp>& e)
+ template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
+ number& operator&=(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
{
BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The bitwise & operation is only valid for integer types");
// Create a temporary if the RHS references *this, but not
@@ -403,17 +467,17 @@
if(contains_self(e) && !is_self(e))
{
self_type temp(e);
- do_bitwise_and(temp, detail::terminal());
+ do_bitwise_and(detail::expression<detail::terminal, self_type>(temp), detail::terminal());
}
else
{
- do_bitwise_and(e, typename Exp::tag_type());
+ do_bitwise_and(e, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::tag_type());
}
return *this;
}
template <class V>
- BOOST_FORCEINLINE typename enable_if<boost::is_arithmetic<V>, number<Backend, ExpressionTemplates>& >::type
+ BOOST_FORCEINLINE typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
operator&=(const V& v)
{
BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The bitwise & operation is only valid for integer types");
@@ -429,8 +493,8 @@
return *this;
}
- template <class Exp>
- number& operator|=(const detail::expression<Exp>& e)
+ template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
+ number& operator|=(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
{
BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The bitwise | operation is only valid for integer types");
// Create a temporary if the RHS references *this, but not
@@ -438,17 +502,17 @@
if(contains_self(e) && !is_self(e))
{
self_type temp(e);
- do_bitwise_or(temp, detail::terminal());
+ do_bitwise_or(detail::expression<detail::terminal, self_type>(temp), detail::terminal());
}
else
{
- do_bitwise_or(e, typename Exp::tag_type());
+ do_bitwise_or(e, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::tag_type());
}
return *this;
}
template <class V>
- BOOST_FORCEINLINE typename enable_if<boost::is_arithmetic<V>, number<Backend, ExpressionTemplates>& >::type
+ BOOST_FORCEINLINE typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
operator|=(const V& v)
{
BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The bitwise | operation is only valid for integer types");
@@ -464,24 +528,24 @@
return *this;
}
- template <class Exp>
- number& operator^=(const detail::expression<Exp>& e)
+ template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
+ number& operator^=(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
{
BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The bitwise ^ operation is only valid for integer types");
if(contains_self(e))
{
self_type temp(e);
- do_bitwise_xor(temp, detail::terminal());
+ do_bitwise_xor(detail::expression<detail::terminal, self_type>(temp), detail::terminal());
}
else
{
- do_bitwise_xor(e, typename Exp::tag_type());
+ do_bitwise_xor(e, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::tag_type());
}
return *this;
}
template <class V>
- BOOST_FORCEINLINE typename enable_if<boost::is_arithmetic<V>, number<Backend, ExpressionTemplates>& >::type
+ BOOST_FORCEINLINE typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
operator^=(const V& v)
{
BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The bitwise ^ operation is only valid for integer types");
@@ -1535,6 +1599,8 @@
BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_realy_self(const self_type& v)const BOOST_NOEXCEPT{ return &v == this; }
static BOOST_FORCEINLINE BOOST_CONSTEXPR const Backend& canonical_value(const self_type& v) BOOST_NOEXCEPT { return v.m_backend; }
+ template <class B2, bool ET>
+ static BOOST_FORCEINLINE BOOST_CONSTEXPR const B2& canonical_value(const number<B2, ET>& v) BOOST_NOEXCEPT { return v.backend(); }
template <class V>
static BOOST_FORCEINLINE BOOST_CONSTEXPR typename detail::canonical<V, Backend>::type canonical_value(const V& v) BOOST_NOEXCEPT { return static_cast<typename detail::canonical<V, Backend>::type>(v); }
static BOOST_FORCEINLINE typename detail::canonical<std::string, Backend>::type canonical_value(const std::string& v) BOOST_NOEXCEPT { return v.c_str(); }
@@ -1583,7 +1649,7 @@
{
std::string s;
is >> s;
- r = s;
+ r.assign(s);
return is;
}
@@ -1613,7 +1679,7 @@
s1.append(1, c);
is.get();
}
- v1 = s1;
+ v1.assign(s1);
s1.erase();
if(c == '/')
{
@@ -1625,7 +1691,7 @@
s1.append(1, c);
is.get();
}
- v2 = s1;
+ v2.assign(s1);
}
else
v2 = 1;
Modified: sandbox/big_number/boost/multiprecision/rational_adapter.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/rational_adapter.hpp (original)
+++ sandbox/big_number/boost/multiprecision/rational_adapter.hpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -53,12 +53,32 @@
m_value = o;
return *this;
}
- template <class Arithmetic>
- typename enable_if<is_arithmetic<Arithmetic>, rational_adapter&>::type operator = (Arithmetic i)
+ template <class Int>
+ typename enable_if<is_integral<Int>, rational_adapter&>::type operator = (Int i)
{
m_value = i;
return *this;
}
+ template <class Float>
+ typename enable_if<is_floating_point<Float>, rational_adapter&>::type operator = (Float i)
+ {
+ int e;
+ Float f = std::frexp(i, &e);
+ f = std::ldexp(f, std::numeric_limits<Float>::digits);
+ e -= std::numeric_limits<Float>::digits;
+ integer_type num(f);
+ integer_type denom(1u);
+ if(e > 0)
+ {
+ num <<= e;
+ }
+ else if(e < 0)
+ {
+ denom <<= -e;
+ }
+ m_value.assign(num, denom);
+ return *this;
+ }
rational_adapter& operator = (const char* s)
{
std::string s1;
@@ -74,7 +94,7 @@
s1.append(1, c);
++s;
}
- v1 = s1;
+ v1.assign(s1);
s1.erase();
if(c == '/')
{
@@ -86,7 +106,7 @@
s1.append(1, c);
++s;
}
- v2 = s1;
+ v2.assign(s1);
}
else
v2 = 1;
Modified: sandbox/big_number/libs/multiprecision/test/Jamfile.v2
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/Jamfile.v2 (original)
+++ sandbox/big_number/libs/multiprecision/test/Jamfile.v2 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -698,6 +698,14 @@
release # Otherwise runtime is slow
: test_rational_io_mpz ;
+run test_rational_io.cpp
+ : # command line
+ : # input files
+ : # requirements
+ <define>TEST_CPP_INT
+ release # Otherwise runtime is slow
+ : test_rational_io_cpp_int ;
+
run test_generic_conv.cpp
: # command line
: # input files
@@ -792,6 +800,10 @@
}
}
+for local source in [ glob compile_fail/*.cpp ]
+{
+ compile-fail $(source) ;
+}
if ! $(disable-concepts)
{
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_1.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_1.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,17 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+void foo(cpp_int i)
+{
+}
+
+int main()
+{
+ foo(2.3); // conversion from float is explicit
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_10.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_10.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i = 2;
+ i -= 2.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_11.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_11.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i = 2;
+ i *= 2.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_12.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_12.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i = 2;
+ i /= 2.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_13.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_13.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i = 2;
+ i %= 2.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_14.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_14.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i = 2;
+ i |= 2.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_15.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_15.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i = 2;
+ i ^= 2.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_16.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_16.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i = 2;
+ i &= 2.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_17.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_17.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,15 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+#include <boost/multiprecision/cpp_dec_float.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_dec_float_50 a(2), b(3);
+ cpp_int i(a);
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_18.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_18.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+#include <boost/multiprecision/cpp_dec_float.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_dec_float_50 a(2), b(3);
+ cpp_int i(2);
+ i = a;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_19.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_19.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,15 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+#include <boost/multiprecision/cpp_dec_float.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_dec_float_50 a(2), b(3);
+ cpp_int i(a + b);
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_2.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_2.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i = 2;
+ i == 2.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_20.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_20.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+#include <boost/multiprecision/cpp_dec_float.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_dec_float_50 a(2), b(3);
+ cpp_int i(3);
+ i = a * b;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_21.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_21.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+#include <boost/multiprecision/cpp_dec_float.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_dec_float_50 a(2), b(3);
+ cpp_int i(3);
+ i += a * b;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_22.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_22.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+#include <boost/multiprecision/cpp_dec_float.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_dec_float_50 a(2), b(3);
+ cpp_int i(3);
+ i -= a * b;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_23.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_23.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+#include <boost/multiprecision/cpp_dec_float.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_dec_float_50 a(2), b(3);
+ cpp_int i(3);
+ i *= a * b;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_24.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_24.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+#include <boost/multiprecision/cpp_dec_float.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_dec_float_50 a(2), b(3);
+ cpp_int i(3);
+ i /= a * b;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_25.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_25.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+#include <boost/multiprecision/cpp_dec_float.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_dec_float_50 a(2), b(3);
+ cpp_int i(3);
+ i %= a * b;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_26.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_26.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+#include <boost/multiprecision/cpp_dec_float.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_dec_float_50 a(2), b(3);
+ cpp_int i(3);
+ i &= a * b;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_27.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_27.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+#include <boost/multiprecision/cpp_dec_float.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_dec_float_50 a(2), b(3);
+ cpp_int i(3);
+ i |= a * b;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_28.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_28.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+#include <boost/multiprecision/cpp_dec_float.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_dec_float_50 a(2), b(3);
+ cpp_int i(3);
+ i ^= a * b;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_29.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_29.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i(3), j;
+ j = i + 3.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_3.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_3.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i = 2;
+ i != 2.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_30.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_30.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i(3), j;
+ j = 3.3 + i;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_31.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_31.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i(3), j;
+ j = 3.3 - i;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_32.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_32.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i(3), j;
+ j = i - 3.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_33.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_33.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i(3), j;
+ j = i * 3.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_34.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_34.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i(3), j;
+ j = 3.3 * i;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_35.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_35.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i(3), j;
+ j = 3.3 / i;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_36.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_36.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i(3), j;
+ j = i / 3.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_37.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_37.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i(3), j;
+ j = i % 3.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_38.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_38.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i(3), j;
+ j = 3.3 % i;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_39.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_39.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i(3), j;
+ j = 3.3 & i;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_4.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_4.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i = 2;
+ i <= 2.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_40.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_40.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i(3), j;
+ j = i & 3.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_41.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_41.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i(3), j;
+ j = i | 3.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_42.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_42.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i(3), j;
+ j = 3.3 | i;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_43.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_43.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i(3), j;
+ j = 3.3 ^ i;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_44.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_44.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i(3), j;
+ j = i ^ 3.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_5.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_5.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i = 2;
+ i >= 2.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_6.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_6.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i = 2;
+ i > 2.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_7.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_7.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i = 2;
+ i < 2.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_8.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_8.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i = 2;
+ i = 2.3;
+}
Added: sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_9.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/compile_fail/conv_fail_9.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+using namespace boost::multiprecision;
+
+int main()
+{
+ cpp_int i = 2;
+ i += 2.3;
+}
Modified: sandbox/big_number/libs/multiprecision/test/math/log1p_expm1_test.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/log1p_expm1_test.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/log1p_expm1_test.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -46,7 +46,7 @@
#include <boost/math/special_functions/log1p.hpp>
#include <boost/math/special_functions/expm1.hpp>
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#include "libs/math/test/log1p_expm1_test.hpp"
Modified: sandbox/big_number/libs/multiprecision/test/math/powm1_sqrtp1m1_test.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/powm1_sqrtp1m1_test.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/powm1_sqrtp1m1_test.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -46,7 +46,7 @@
#include <boost/math/special_functions/sqrt1pm1.hpp>
#include <boost/math/special_functions/powm1.hpp>
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#include "libs/math/test/powm1_sqrtp1m1_test.hpp"
Added: sandbox/big_number/libs/multiprecision/test/math/table_type.hpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/test/math/table_type.hpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -0,0 +1,39 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifndef BOOST_MP_TABLE_TYPE
+
+#include <libs/math/test/table_type.hpp>
+#include <boost/multiprecision/number.hpp>
+
+struct string_table_entry
+{
+private:
+ const char* m_data;
+public:
+ string_table_entry(const char* p) : m_data(p) {}
+
+ template <class T>
+ operator T () const
+ {
+ return static_cast<T>(m_data);
+ }
+};
+
+inline std::ostream& operator << (std::ostream& os, string_table_entry const & what)
+{
+ return os << static_cast<const char*>(what);
+}
+
+template <class Backend, bool ExpressionTemplates>
+struct table_type<boost::multiprecision::number<Backend, ExpressionTemplates> >
+{
+ typedef string_table_entry type;
+};
+
+#define SC_(x) string_table_entry(BOOST_STRINGIZE(x))
+
+#endif
+
Modified: sandbox/big_number/libs/multiprecision/test/math/test_bessel_i.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_bessel_i.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_bessel_i.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -41,7 +41,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_STRINGIZE(x))
#include <boost/math/special_functions/bessel.hpp>
#include "libs/math/test/test_bessel_i.hpp"
Modified: sandbox/big_number/libs/multiprecision/test/math/test_bessel_j.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_bessel_j.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_bessel_j.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -41,7 +41,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#include <boost/math/special_functions/bessel.hpp>
#include "libs/math/test/test_bessel_j.hpp"
Modified: sandbox/big_number/libs/multiprecision/test/math/test_bessel_k.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_bessel_k.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_bessel_k.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -42,7 +42,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#include <boost/math/special_functions/bessel.hpp>
#include "libs/math/test/test_bessel_k.hpp"
Modified: sandbox/big_number/libs/multiprecision/test/math/test_bessel_y.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_bessel_y.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_bessel_y.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -41,7 +41,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#include <boost/math/special_functions/bessel.hpp>
#include "libs/math/test/test_bessel_y.hpp"
Modified: sandbox/big_number/libs/multiprecision/test/math/test_beta.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_beta.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_beta.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -41,7 +41,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#include <boost/math/special_functions/beta.hpp>
#include "libs/math/test/test_beta.hpp"
Modified: sandbox/big_number/libs/multiprecision/test/math/test_binomial_coeff.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_binomial_coeff.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_binomial_coeff.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -41,7 +41,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#include <boost/math/special_functions/binomial.hpp>
#include "libs/math/test/test_binomial_coeff.hpp"
Modified: sandbox/big_number/libs/multiprecision/test/math/test_carlson.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_carlson.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_carlson.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -36,7 +36,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#include <boost/math/special_functions/ellint_rc.hpp>
Modified: sandbox/big_number/libs/multiprecision/test/math/test_cbrt.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_cbrt.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_cbrt.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -36,7 +36,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#include <boost/math/special_functions/cbrt.hpp>
Modified: sandbox/big_number/libs/multiprecision/test/math/test_digamma.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_digamma.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_digamma.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -36,7 +36,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#include <boost/math/special_functions/digamma.hpp>
Modified: sandbox/big_number/libs/multiprecision/test/math/test_ellint_1.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_ellint_1.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_ellint_1.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -36,7 +36,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#include <boost/math/special_functions/ellint_1.hpp>
Modified: sandbox/big_number/libs/multiprecision/test/math/test_ellint_2.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_ellint_2.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_ellint_2.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -36,7 +36,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#include <boost/math/special_functions/ellint_2.hpp>
Modified: sandbox/big_number/libs/multiprecision/test/math/test_ellint_3.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_ellint_3.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_ellint_3.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -36,7 +36,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#include <boost/math/special_functions/ellint_3.hpp>
Modified: sandbox/big_number/libs/multiprecision/test/math/test_erf.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_erf.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_erf.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -36,7 +36,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#include <boost/math/special_functions/erf.hpp>
Modified: sandbox/big_number/libs/multiprecision/test/math/test_expint.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_expint.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_expint.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -36,7 +36,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#include <boost/math/special_functions/expint.hpp>
Modified: sandbox/big_number/libs/multiprecision/test/math/test_gamma.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_gamma.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_gamma.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -36,7 +36,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#include <boost/math/special_functions/gamma.hpp>
Modified: sandbox/big_number/libs/multiprecision/test/math/test_hermite.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_hermite.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_hermite.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -36,7 +36,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#include <boost/math/special_functions/hermite.hpp>
Modified: sandbox/big_number/libs/multiprecision/test/math/test_ibeta.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_ibeta.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_ibeta.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -37,7 +37,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#define TEST_DATA 1
Modified: sandbox/big_number/libs/multiprecision/test/math/test_ibeta_2.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_ibeta_2.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_ibeta_2.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -37,7 +37,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#define TEST_DATA 2
Modified: sandbox/big_number/libs/multiprecision/test/math/test_ibeta_3.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_ibeta_3.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_ibeta_3.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -37,7 +37,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#define TEST_DATA 3
Modified: sandbox/big_number/libs/multiprecision/test/math/test_ibeta_4.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_ibeta_4.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_ibeta_4.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -37,7 +37,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#define TEST_DATA 4
Modified: sandbox/big_number/libs/multiprecision/test/math/test_ibeta_inv_1.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_ibeta_inv_1.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_ibeta_inv_1.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -37,7 +37,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#define TEST_DATA 4
Modified: sandbox/big_number/libs/multiprecision/test/math/test_ibeta_inv_ab_4.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_ibeta_inv_ab_4.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_ibeta_inv_ab_4.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -36,7 +36,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#define TEST_DATA 4
Modified: sandbox/big_number/libs/multiprecision/test/math/test_igamma.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_igamma.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_igamma.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -37,7 +37,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#include <boost/math/special_functions/gamma.hpp>
#include "libs/math/test/test_igamma.hpp"
Modified: sandbox/big_number/libs/multiprecision/test/math/test_igamma_inv.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_igamma_inv.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_igamma_inv.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -37,7 +37,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#include <boost/math/special_functions/gamma.hpp>
Modified: sandbox/big_number/libs/multiprecision/test/math/test_igamma_inva.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_igamma_inva.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_igamma_inva.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -37,7 +37,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#include <boost/math/special_functions/gamma.hpp>
Modified: sandbox/big_number/libs/multiprecision/test/math/test_laguerre.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_laguerre.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_laguerre.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -36,7 +36,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#include <boost/math/special_functions/laguerre.hpp>
Modified: sandbox/big_number/libs/multiprecision/test/math/test_legendre.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_legendre.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_legendre.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -36,7 +36,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#include <boost/math/special_functions/legendre.hpp>
Modified: sandbox/big_number/libs/multiprecision/test/math/test_tgamma_ratio.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_tgamma_ratio.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_tgamma_ratio.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -36,7 +36,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#include <boost/math/special_functions/gamma.hpp>
Modified: sandbox/big_number/libs/multiprecision/test/math/test_zeta.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/math/test_zeta.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/math/test_zeta.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -36,7 +36,7 @@
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
-#define SC_(x) BOOST_STRINGIZE(x)
+#include "table_type.hpp"
#define TEST_UDT
#include <boost/math/special_functions/zeta.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 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -53,21 +53,21 @@
//
static const boost::array<boost::array<T, 2>, 13> exact_data =
{{
- {{ 0.5, "1.04719755119659774615421446109316762806572313312503527365831486410260546876206966620934494178070568932738269550442743555" }},
- {{ 0.25, "1.31811607165281796574566425464604046984639096659071471685354851741333314266208327690226867044304393238598144034722708676" }},
- {{0.75, "0.722734247813415611178377352641333362025218486424440267626754132583707381914630264964827610939101303690078815991333621490" }},
- {{1 - std::ldexp(1.0, -20), "0.00138106804176241718210883847756746694048570648553426714212025111150044290934710742282266738617709904634187850607042604204" }},
- {{std::ldexp(1.0, -20), "1.57079537312058021283676140197495835299636605165647561806789944133748780804448843729970624018104090863783682329820313127" }},
- {{1, "0" }},
-
- {{0, "1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404325664115332" }},
-
- {{ -0.5, "2.09439510239319549230842892218633525613144626625007054731662972820521093752413933241868988356141137865476539100885487110" }},
- {{ -0.25, "1.82347658193697527271697912863346241435077843278439110412139607489448326362412572172576615489907313559616664616605521989" }},
- {{-0.75, "2.41885840577637762728426603063816952217195091295066555334819045972410902437157873366320721440301576429206927052194868516" }},
- {{-1 + std::ldexp(1.0, -20), "3.14021158554803082128053454480193541725668369288957155383282434119631596337686189120521215795593996893580620800721188061" }},
- {{-std::ldexp(1.0, -20), "1.57079728046921302562588198130454453120080334771863020290704515097032859824172056132832858516107615934431126321507917538" }},
- {{-1, "3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230665" }},
+ {{ 0.5, static_cast<T>("1.04719755119659774615421446109316762806572313312503527365831486410260546876206966620934494178070568932738269550442743555") }},
+ {{ 0.25, static_cast<T>("1.31811607165281796574566425464604046984639096659071471685354851741333314266208327690226867044304393238598144034722708676") }},
+ {{0.75, static_cast<T>("0.722734247813415611178377352641333362025218486424440267626754132583707381914630264964827610939101303690078815991333621490") }},
+ {{1 - std::ldexp(1.0, -20), static_cast<T>("0.00138106804176241718210883847756746694048570648553426714212025111150044290934710742282266738617709904634187850607042604204") }},
+ {{std::ldexp(1.0, -20), static_cast<T>("1.57079537312058021283676140197495835299636605165647561806789944133748780804448843729970624018104090863783682329820313127") }},
+ {{1, static_cast<T>("0") }},
+
+ {{0, static_cast<T>("1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404325664115332") }},
+
+ {{ -0.5, static_cast<T>("2.09439510239319549230842892218633525613144626625007054731662972820521093752413933241868988356141137865476539100885487110") }},
+ {{ -0.25, static_cast<T>("1.82347658193697527271697912863346241435077843278439110412139607489448326362412572172576615489907313559616664616605521989") }},
+ {{-0.75, static_cast<T>("2.41885840577637762728426603063816952217195091295066555334819045972410902437157873366320721440301576429206927052194868516") }},
+ {{-1 + std::ldexp(1.0, -20), static_cast<T>("3.14021158554803082128053454480193541725668369288957155383282434119631596337686189120521215795593996893580620800721188061") }},
+ {{-std::ldexp(1.0, -20), static_cast<T>("1.57079728046921302562588198130454453120080334771863020290704515097032859824172056132832858516107615934431126321507917538") }},
+ {{-1, static_cast<T>("3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230665") }},
}};
unsigned max_err = 0;
for(unsigned k = 0; k < exact_data.size(); k++)
Modified: sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -64,16 +64,17 @@
#if defined(TEST_CPP_INT) || defined(TEST_CPP_INT_BR)
#include <boost/multiprecision/cpp_int.hpp>
#endif
+
+template <class T>
+struct is_boost_rational : public boost::mpl::false_{};
+
#if defined(TEST_TOMMATH_BOOST_RATIONAL) || defined(TEST_MPZ_BOOST_RATIONAL)
#include <boost/rational.hpp>
#define NO_MIXED_OPS
template <class T>
-bool is_boost_rational(const boost::rational<T>&)
-{
- return true;
-}
+struct is_boost_rational<boost::rational<T> > : public boost::mpl::true_{};
namespace boost{ namespace multiprecision{
@@ -138,7 +139,11 @@
#define BOOST_TEST_EQUAL(a, b) BOOST_TEST((a) == (b))
template <class Real, class Val>
-void test_comparisons(Val a, Val b)
+void test_comparisons(Val, Val, const boost::mpl::false_)
+{}
+
+template <class Real, class Val>
+void test_comparisons(Val a, Val b, const boost::mpl::true_)
{
Real r1(a);
Real r2(b);
@@ -222,14 +227,28 @@
template <class Real, class T>
void test_integer_ops(const T&){}
-template <class T>
-bool is_boost_rational(const T&)
+template <class Real>
+void test_rational(const boost::mpl::true_&)
{
- return false;
+ Real a(2);
+ a /= 3;
+ BOOST_TEST(numerator(a) == 2);
+ BOOST_TEST(denominator(a) == 3);
+ Real b(4);
+ b /= 6;
+ BOOST_TEST(a == b);
+
+ //
+ // Check IO code:
+ //
+ std::stringstream ss;
+ ss << a;
+ ss >> b;
+ BOOST_CHECK_EQUAL(a, b);
}
template <class Real>
-void test_integer_ops(const boost::mpl::int_<boost::multiprecision::number_kind_rational>&)
+void test_rational(const boost::mpl::false_&)
{
Real a(2);
a /= 3;
@@ -239,17 +258,10 @@
b /= 6;
BOOST_TEST(a == b);
- //
- // Boost.Rational has a slightly different error handling stategy,
- // we only test our own:
- //
- if(!is_boost_rational(a))
- {
- BOOST_CHECK_THROW(Real(a / 0), std::overflow_error);
- BOOST_CHECK_THROW(Real("3.14"), std::runtime_error);
- b = "2/3";
- BOOST_CHECK_EQUAL(a, b);
- }
+ BOOST_CHECK_THROW(Real(a / 0), std::overflow_error);
+ BOOST_CHECK_THROW(Real("3.14"), std::runtime_error);
+ b = Real("2/3");
+ BOOST_CHECK_EQUAL(a, b);
//
// Check IO code:
//
@@ -260,6 +272,12 @@
}
template <class Real>
+void test_integer_ops(const boost::mpl::int_<boost::multiprecision::number_kind_rational>&)
+{
+ test_rational<Real>(is_boost_rational<Real>());
+}
+
+template <class Real>
void test_integer_ops(const boost::mpl::int_<boost::multiprecision::number_kind_integer>&)
{
Real a(20);
@@ -661,6 +679,16 @@
if(std::numeric_limits<Real>::is_specialized && !std::numeric_limits<Real>::is_signed)
return;
typedef typename lexical_cast_target_type<Num>::type target_type;
+ typedef typename boost::mpl::if_<
+ boost::is_convertible<Num, Real>,
+ typename boost::mpl::if_c<boost::is_integral<Num>::value && (sizeof(Num) < sizeof(int)), int, Num>::type,
+ Real
+ >::type cast_type;
+ typedef typename boost::mpl::if_<
+ boost::is_convertible<Num, Real>,
+ Num,
+ Real
+ >::type simple_cast_type;
std::cout << "Testing mixed arithmetic with type: " << typeid(Real).name() << " and " << typeid(Num).name() << std::endl;
Num n1 = -static_cast<Num>(1uLL << (std::numeric_limits<Num>::digits - 1));
Num n2 = -1;
@@ -668,22 +696,22 @@
Num n4 = -20;
Num n5 = -8;
- test_comparisons<Real>(n1, n2);
- test_comparisons<Real>(n1, n3);
- test_comparisons<Real>(n3, n1);
- test_comparisons<Real>(n2, n1);
- test_comparisons<Real>(n1, n1);
- test_comparisons<Real>(n3, n3);
+ test_comparisons<Real>(n1, n2, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n1, n3, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n3, n1, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n2, n1, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n1, n1, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n3, n3, boost::is_convertible<Num, Real>());
// Default construct:
- BOOST_TEST(Real(n1) == n1);
- BOOST_TEST(Real(n2) == n2);
- BOOST_TEST(Real(n3) == n3);
- BOOST_TEST(Real(n4) == n4);
- BOOST_TEST(n1 == Real(n1));
- BOOST_TEST(n2 == Real(n2));
- BOOST_TEST(n3 == Real(n3));
- BOOST_TEST(n4 == Real(n4));
+ BOOST_TEST(Real(n1) == static_cast<cast_type>(n1));
+ BOOST_TEST(Real(n2) == static_cast<cast_type>(n2));
+ BOOST_TEST(Real(n3) == static_cast<cast_type>(n3));
+ BOOST_TEST(Real(n4) == static_cast<cast_type>(n4));
+ BOOST_TEST(static_cast<cast_type>(n1) == Real(n1));
+ BOOST_TEST(static_cast<cast_type>(n2) == Real(n2));
+ BOOST_TEST(static_cast<cast_type>(n3) == Real(n3));
+ BOOST_TEST(static_cast<cast_type>(n4) == Real(n4));
BOOST_TEST(Real(n1).template convert_to<Num>() == n1);
BOOST_TEST(Real(n2).template convert_to<Num>() == n2);
BOOST_TEST(Real(n3).template convert_to<Num>() == n3);
@@ -709,54 +737,54 @@
BOOST_TEST_CLOSE(n4, boost::lexical_cast<target_type>(Real(n4).str(0, f)), 0);
// Assignment:
Real r(0);
- BOOST_TEST(r != n1);
- r = n1;
- BOOST_TEST(r == n1);
- r = n2;
- BOOST_TEST(r == n2);
- r = n3;
- BOOST_TEST(r == n3);
- r = n4;
- BOOST_TEST(r == n4);
+ BOOST_TEST(r != static_cast<cast_type>(n1));
+ r = static_cast<simple_cast_type>(n1);
+ BOOST_TEST(r == static_cast<cast_type>(n1));
+ r = static_cast<simple_cast_type>(n2);
+ BOOST_TEST(r == static_cast<cast_type>(n2));
+ r = static_cast<simple_cast_type>(n3);
+ BOOST_TEST(r == static_cast<cast_type>(n3));
+ r = static_cast<simple_cast_type>(n4);
+ BOOST_TEST(r == static_cast<cast_type>(n4));
// Addition:
- r = n2;
- BOOST_TEST(r + n4 == n2 + n4);
- BOOST_TEST(Real(r + n4) == n2 + n4);
- r += n4;
- BOOST_TEST(r == n2 + n4);
+ r = static_cast<simple_cast_type>(n2);
+ BOOST_TEST(r + static_cast<simple_cast_type>(n4) == static_cast<cast_type>(n2 + n4));
+ BOOST_TEST(Real(r + static_cast<simple_cast_type>(n4)) == static_cast<cast_type>(n2 + n4));
+ r += static_cast<simple_cast_type>(n4);
+ BOOST_TEST(r == static_cast<cast_type>(n2 + n4));
// subtraction:
- r = n4;
- BOOST_TEST(r - n5 == n4 - n5);
- BOOST_TEST(Real(r - n5) == n4 - n5);
- r -= n5;
- BOOST_TEST(r == n4 - n5);
+ r = static_cast<simple_cast_type>(n4);
+ BOOST_TEST(r - static_cast<simple_cast_type>(n5) == static_cast<cast_type>(n4 - n5));
+ BOOST_TEST(Real(r - static_cast<simple_cast_type>(n5)) == static_cast<cast_type>(n4 - n5));
+ r -= static_cast<simple_cast_type>(n5);
+ BOOST_TEST(r == static_cast<cast_type>(n4 - n5));
// Multiplication:
- r = n2;
- BOOST_TEST(r * n4 == n2 * n4);
- BOOST_TEST(Real(r * n4) == n2 * n4);
- r *= n4;
- BOOST_TEST(r == n2 * n4);
+ r = static_cast<simple_cast_type>(n2);
+ BOOST_TEST(r * static_cast<simple_cast_type>(n4) == static_cast<cast_type>(n2 * n4));
+ BOOST_TEST(Real(r * static_cast<simple_cast_type>(n4)) == static_cast<cast_type>(n2 * n4));
+ r *= static_cast<simple_cast_type>(n4);
+ BOOST_TEST(r == static_cast<cast_type>(n2 * n4));
// Division:
- r = n1;
- BOOST_TEST(r / n5 == n1 / n5);
- BOOST_TEST(Real(r / n5) == n1 / n5);
- r /= n5;
- BOOST_TEST(r == n1 / n5);
+ r = static_cast<simple_cast_type>(n1);
+ BOOST_TEST(r / static_cast<simple_cast_type>(n5) == static_cast<cast_type>(n1 / n5));
+ BOOST_TEST(Real(r / static_cast<simple_cast_type>(n5)) == static_cast<cast_type>(n1 / n5));
+ r /= static_cast<simple_cast_type>(n5);
+ BOOST_TEST(r == static_cast<cast_type>(n1 / n5));
//
// Extra cases for full coverage:
//
- r = Real(n4) + n5;
- BOOST_TEST(r == n4 + n5);
- r = n4 + Real(n5);
- BOOST_TEST(r == n4 + n5);
- r = Real(n4) - n5;
- BOOST_TEST(r == n4 - n5);
- r = n4 - Real(n5);
- BOOST_TEST(r == n4 - n5);
- r = n4 * Real(n5);
- BOOST_TEST(r == n4 * n5);
- r = (4 * n4) / Real(4);
- BOOST_TEST(r == n4);
+ r = Real(n4) + static_cast<simple_cast_type>(n5);
+ BOOST_TEST(r == static_cast<cast_type>(n4 + n5));
+ r = static_cast<simple_cast_type>(n4) + Real(n5);
+ BOOST_TEST(r == static_cast<cast_type>(n4 + n5));
+ r = Real(n4) - static_cast<simple_cast_type>(n5);
+ BOOST_TEST(r == static_cast<cast_type>(n4 - n5));
+ r = static_cast<simple_cast_type>(n4) - Real(n5);
+ BOOST_TEST(r == static_cast<cast_type>(n4 - n5));
+ r = static_cast<simple_cast_type>(n4) * Real(n5);
+ BOOST_TEST(r == static_cast<cast_type>(n4 * n5));
+ r = static_cast<cast_type>(4 * n4) / Real(4);
+ BOOST_TEST(r == static_cast<cast_type>(n4));
}
template <class Real, class Num>
@@ -768,6 +796,16 @@
void test_mixed()
{
typedef typename lexical_cast_target_type<Num>::type target_type;
+ typedef typename boost::mpl::if_<
+ boost::is_convertible<Num, Real>,
+ typename boost::mpl::if_c<boost::is_integral<Num>::value && (sizeof(Num) < sizeof(int)), int, Num>::type,
+ Real
+ >::type cast_type;
+ typedef typename boost::mpl::if_<
+ boost::is_convertible<Num, Real>,
+ Num,
+ Real
+ >::type simple_cast_type;
if(std::numeric_limits<Real>::digits < std::numeric_limits<Num>::digits)
return;
@@ -779,18 +817,18 @@
Num n4 = 20;
Num n5 = 8;
- test_comparisons<Real>(n1, n2);
- test_comparisons<Real>(n1, n3);
- test_comparisons<Real>(n1, n1);
- test_comparisons<Real>(n3, n1);
- test_comparisons<Real>(n2, n1);
- test_comparisons<Real>(n3, n3);
+ test_comparisons<Real>(n1, n2, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n1, n3, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n1, n1, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n3, n1, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n2, n1, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n3, n3, boost::is_convertible<Num, Real>());
// Default construct:
- BOOST_TEST(Real(n1) == n1);
- BOOST_TEST(Real(n2) == n2);
- BOOST_TEST(Real(n3) == n3);
- BOOST_TEST(Real(n4) == n4);
+ BOOST_TEST(Real(n1) == static_cast<cast_type>(n1));
+ BOOST_TEST(Real(n2) == static_cast<cast_type>(n2));
+ BOOST_TEST(Real(n3) == static_cast<cast_type>(n3));
+ BOOST_TEST(Real(n4) == static_cast<cast_type>(n4));
BOOST_TEST(Real(n1).template convert_to<Num>() == n1);
BOOST_TEST(Real(n2).template convert_to<Num>() == n2);
BOOST_TEST(Real(n3).template convert_to<Num>() == n3);
@@ -801,10 +839,10 @@
BOOST_TEST(static_cast<Num>(Real(n3)) == n3);
BOOST_TEST(static_cast<Num>(Real(n4)) == n4);
#endif
- BOOST_TEST(n1 == Real(n1));
- BOOST_TEST(n2 == Real(n2));
- BOOST_TEST(n3 == Real(n3));
- BOOST_TEST(n4 == Real(n4));
+ BOOST_TEST(static_cast<cast_type>(n1) == Real(n1));
+ BOOST_TEST(static_cast<cast_type>(n2) == Real(n2));
+ BOOST_TEST(static_cast<cast_type>(n3) == Real(n3));
+ BOOST_TEST(static_cast<cast_type>(n4) == Real(n4));
#if defined(TEST_MPFR) || defined(TEST_MPFR_50)
Num tol = 10 * std::numeric_limits<Num>::epsilon();
#else
@@ -820,50 +858,50 @@
BOOST_TEST_CLOSE(n4, boost::lexical_cast<target_type>(Real(n4).str(0, f)), 0);
// Assignment:
Real r(0);
- BOOST_TEST(r != n1);
- r = n1;
- BOOST_TEST(r == n1);
- r = n2;
- BOOST_TEST(r == n2);
- r = n3;
- BOOST_TEST(r == n3);
- r = n4;
- BOOST_TEST(r == n4);
+ BOOST_TEST(r != static_cast<cast_type>(n1));
+ r = static_cast<simple_cast_type>(n1);
+ BOOST_TEST(r == static_cast<cast_type>(n1));
+ r = static_cast<simple_cast_type>(n2);
+ BOOST_TEST(r == static_cast<cast_type>(n2));
+ r = static_cast<simple_cast_type>(n3);
+ BOOST_TEST(r == static_cast<cast_type>(n3));
+ r = static_cast<simple_cast_type>(n4);
+ BOOST_TEST(r == static_cast<cast_type>(n4));
// Addition:
- r = n2;
- BOOST_TEST(r + n4 == n2 + n4);
- BOOST_TEST(Real(r + n4) == n2 + n4);
- r += n4;
- BOOST_TEST(r == n2 + n4);
+ r = static_cast<simple_cast_type>(n2);
+ BOOST_TEST(r + static_cast<simple_cast_type>(n4) == static_cast<cast_type>(n2 + n4));
+ BOOST_TEST(Real(r + static_cast<simple_cast_type>(n4)) == static_cast<cast_type>(n2 + n4));
+ r += static_cast<simple_cast_type>(n4);
+ BOOST_TEST(r == static_cast<cast_type>(n2 + n4));
// subtraction:
- r = n4;
- BOOST_TEST(r - n5 == n4 - n5);
- BOOST_TEST(Real(r - n5) == n4 - n5);
- r -= n5;
- BOOST_TEST(r == n4 - n5);
+ r = static_cast<simple_cast_type>(n4);
+ BOOST_TEST(r - static_cast<simple_cast_type>(n5) == static_cast<cast_type>(n4 - n5));
+ BOOST_TEST(Real(r - static_cast<simple_cast_type>(n5)) == static_cast<cast_type>(n4 - n5));
+ r -= static_cast<simple_cast_type>(n5);
+ BOOST_TEST(r == static_cast<cast_type>(n4 - n5));
// Multiplication:
- r = n2;
- BOOST_TEST(r * n4 == n2 * n4);
- BOOST_TEST(Real(r * n4) == n2 * n4);
- r *= n4;
- BOOST_TEST(r == n2 * n4);
+ r = static_cast<simple_cast_type>(n2);
+ BOOST_TEST(r * static_cast<simple_cast_type>(n4) == static_cast<cast_type>(n2 * n4));
+ BOOST_TEST(Real(r * static_cast<simple_cast_type>(n4)) == static_cast<cast_type>(n2 * n4));
+ r *= static_cast<simple_cast_type>(n4);
+ BOOST_TEST(r == static_cast<cast_type>(n2 * n4));
// Division:
- r = n1;
- BOOST_TEST(r / n5 == n1 / n5);
- BOOST_TEST(Real(r / n5) == n1 / n5);
- r /= n5;
- BOOST_TEST(r == n1 / n5);
+ r = static_cast<simple_cast_type>(n1);
+ BOOST_TEST(r / static_cast<simple_cast_type>(n5) == static_cast<cast_type>(n1 / n5));
+ BOOST_TEST(Real(r / static_cast<simple_cast_type>(n5)) == static_cast<cast_type>(n1 / n5));
+ r /= static_cast<simple_cast_type>(n5);
+ BOOST_TEST(r == static_cast<cast_type>(n1 / n5));
//
// special cases for full coverage:
//
- r = n5 + Real(n4);
- BOOST_TEST(r == n4 + n5);
- r = n4 - Real(n5);
- BOOST_TEST(r == n4 - n5);
- r = n4 * Real(n5);
- BOOST_TEST(r == n4 * n5);
- r = (4 * n4) / Real(4);
- BOOST_TEST(r == n4);
+ r = static_cast<simple_cast_type>(n5) + Real(n4);
+ BOOST_TEST(r == static_cast<cast_type>(n4 + n5));
+ r = static_cast<simple_cast_type>(n4) - Real(n5);
+ BOOST_TEST(r == static_cast<cast_type>(n4 - n5));
+ r = static_cast<simple_cast_type>(n4) * Real(n5);
+ BOOST_TEST(r == static_cast<cast_type>(n4 * n5));
+ r = static_cast<cast_type>(4 * n4) / Real(4);
+ BOOST_TEST(r == static_cast<cast_type>(n4));
test_negative_mixed<Real, Num>(boost::mpl::bool_<std::numeric_limits<Num>::is_signed>());
}
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 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -53,12 +53,12 @@
//
static const boost::array<boost::array<T, 2>, 6> exact_data =
{{
- {{ 0.5, "0.523598775598298873077107230546583814032861566562517636829157432051302734381034833104672470890352844663691347752213717775" }},
- {{ 0.25, "0.252680255142078653485657436993710972252193733096838193633923778740575060481021222411748742228014601605092602909414066566" }},
- {{0.75, "0.848062078981481008052944338998418080073366213263112642860718163570200821228474234349189801731957230300995227265307531834" }},
- {{std::ldexp(1.0, -20), "9.53674316406394560289664793089102218648031077292419572854816420395098616062014311172490017625353237219958438022056661501e-7" }},
- {{ 1 - std::ldexp(1.0, -20), "1.56941525875313420204921285316218397515809899320201864334535204504240776023375739189119474528488143494473216475057072728" }},
- {{ 1, "1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404325664115332354692230477529111586267970406424055872514205135096926055277982231147447746519098221440548783296672306423782411689339158263560095457282428346173017430522716332410669680363012457064" }},
+ {{ 0.5, static_cast<T>("0.523598775598298873077107230546583814032861566562517636829157432051302734381034833104672470890352844663691347752213717775") }},
+ {{ 0.25, static_cast<T>("0.252680255142078653485657436993710972252193733096838193633923778740575060481021222411748742228014601605092602909414066566") }},
+ {{0.75, static_cast<T>("0.848062078981481008052944338998418080073366213263112642860718163570200821228474234349189801731957230300995227265307531834") }},
+ {{std::ldexp(1.0, -20), static_cast<T>("9.53674316406394560289664793089102218648031077292419572854816420395098616062014311172490017625353237219958438022056661501e-7") }},
+ {{ 1 - std::ldexp(1.0, -20), static_cast<T>("1.56941525875313420204921285316218397515809899320201864334535204504240776023375739189119474528488143494473216475057072728") }},
+ {{ 1, static_cast<T>("1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404325664115332354692230477529111586267970406424055872514205135096926055277982231147447746519098221440548783296672306423782411689339158263560095457282428346173017430522716332410669680363012457064") }},
}};
unsigned max_err = 0;
for(unsigned k = 0; k < exact_data.size(); k++)
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 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -123,7 +123,7 @@
"1.570796326794896619231321691639751442098584699687552910487472296153908203143104499314017412671058533891074043256641153323546922304775291115862679704064240558725142051350969260552779822311474477465190982214405487832966723064237824116893391582635600954572824283461730174305227163324106696803630124570637195626836636491127420774093793814747960379191015517279628513338998598607743566594025406809304089138",
}};
- T arg = "1e-100";
+ T arg = static_cast<T>("1e-100");
unsigned max_err = 0;
for(unsigned k = 0; k < data.size(); k++)
@@ -149,7 +149,7 @@
//
// And again, but test all the phases of atan2:
//
- arg = "1e-100";
+ arg = static_cast<T>("1e-100");
unsigned err;
for(unsigned k = 0; k < data.size(); k++)
{
Modified: sandbox/big_number/libs/multiprecision/test/test_constants.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_constants.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_constants.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -172,13 +172,13 @@
typedef typename T::backend_type backend_type;
T num, expect;
num.backend() = boost::multiprecision::default_ops::get_constant_pi<backend_type>();
- expect = pi;
+ expect = static_cast<T>(pi);
BOOST_CHECK_CLOSE_FRACTION(num, expect, std::numeric_limits<T>::epsilon() * (is_mpfr(num) ? 1200 : 2));
num.backend() = boost::multiprecision::default_ops::get_constant_ln2<backend_type>();
- expect = ln2;
+ expect = static_cast<T>(ln2);
BOOST_CHECK_CLOSE_FRACTION(num, expect, std::numeric_limits<T>::epsilon() * (is_mpfr(num) ? 30 : 1));
num.backend() = boost::multiprecision::default_ops::get_constant_e<backend_type>();
- expect = e;
+ expect = static_cast<T>(e);
BOOST_CHECK_CLOSE_FRACTION(num, expect, std::numeric_limits<T>::epsilon() * (is_mpfr(num) ? 2 : 1));
}
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 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -155,7 +155,7 @@
boost::uintmax_t max_err = 0;
for(unsigned k = 0; k < data.size(); k++)
{
- static const T euler_gamma = "5.77215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291746749514631447249807082480960504014486542836224173997644923536253500333742937337737673942792595258247094916008735203948165670853233151776611528621199501507984793745085705740029921354786146694029604325421519e-1";
+ static const T euler_gamma = static_cast<T>("5.77215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291746749514631447249807082480960504014486542836224173997644923536253500333742937337737673942792595258247094916008735203948165670853233151776611528621199501507984793745085705740029921354786146694029604325421519e-1");
T val = cos(euler_gamma * ((100 * k) - 5000));
T e = relative_error(val, T(data[k]));
unsigned err = e.template convert_to<unsigned>();
@@ -225,12 +225,12 @@
"0.09655529472977379853549858833033074225823562054271495313739665642376685099661084023094270272485976247900824483810911634635819558334630910267353320029261330296977292720266655308513559530586843550229208517388789783011887450865488554143475302590353915732321663418057567573042594801866258948380684000769091353165879953111046260532796891917772727185993569684246844052518121013717183610828519193371796413317",
}};
- T half_pi = "1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404325664115332354692230477529111586267970406424055872514205135096926055277982231147447746519098221440548783296672306423782411689339158263560095457282428346173017430522716332410669680363012457064";
+ T half_pi = static_cast<T>("1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404325664115332354692230477529111586267970406424055872514205135096926055277982231147447746519098221440548783296672306423782411689339158263560095457282428346173017430522716332410669680363012457064");
max_err = 0;
for(unsigned k = 0; k < near_one.size(); k++)
{
- static const T euler_gamma = "5.77215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291746749514631447249807082480960504014486542836224173997644923536253500333742937337737673942792595258247094916008735203948165670853233151776611528621199501507984793745085705740029921354786146694029604325421519e-1";
+ static const T euler_gamma = static_cast<T>("5.77215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291746749514631447249807082480960504014486542836224173997644923536253500333742937337737673942792595258247094916008735203948165670853233151776611528621199501507984793745085705740029921354786146694029604325421519e-1");
T val = cos(half_pi - (euler_gamma + k) / 523);
T e = relative_error(val, T(near_one[k]));
unsigned err = e.template convert_to<unsigned>();
@@ -251,14 +251,14 @@
//
static const boost::array<boost::array<T, 2>, 8> exact_data =
{{
- {{ 0.5, "0.877582561890372716116281582603829651991645197109744052997610868315950763274213947405794184084682258355478400593109053993" }},
- {{ 0.25, "0.968912421710644784144595449494189199804134190287442831148128124288942561184523327264655202799685025510352709626116202617" }},
- {{0.75, "0.731688868873820886311838753000084543840541276050772482507683220220750082501569499540967562610201174960122884908227300721" }},
- {{std::ldexp(1.0, -20), "0.99999999999954525264911357034690133684385823577463126432241468890539365027135494672267164697779879113636143901797362388" }},
- {{ 2, "-0.416146836547142386997568229500762189766000771075544890755149973781964936124079169074531777860169140367366791365215728559" }},
- {{ 5, "0.283662185463226264466639171513557308334422592252215944930359066586151456767382702286176981668344573238827368717546699737" }},
- {{ 10, "-0.839071529076452452258863947824064834519930165133168546835953731048792586866270768400933712760422138927451054405350243624" }},
- {{ 8.5, "-0.60201190268482361534842652295699870029606776360435523539636606145572515876770619546025351418378467287262574566665150299" }}
+ {{ 0.5, static_cast<T>("0.877582561890372716116281582603829651991645197109744052997610868315950763274213947405794184084682258355478400593109053993") }},
+ {{ 0.25, static_cast<T>("0.968912421710644784144595449494189199804134190287442831148128124288942561184523327264655202799685025510352709626116202617") }},
+ {{0.75, static_cast<T>("0.731688868873820886311838753000084543840541276050772482507683220220750082501569499540967562610201174960122884908227300721") }},
+ {{std::ldexp(1.0, -20), static_cast<T>("0.99999999999954525264911357034690133684385823577463126432241468890539365027135494672267164697779879113636143901797362388") }},
+ {{ 2, static_cast<T>("-0.416146836547142386997568229500762189766000771075544890755149973781964936124079169074531777860169140367366791365215728559") }},
+ {{ 5, static_cast<T>("0.283662185463226264466639171513557308334422592252215944930359066586151456767382702286176981668344573238827368717546699737") }},
+ {{ 10, static_cast<T>("-0.839071529076452452258863947824064834519930165133168546835953731048792586866270768400933712760422138927451054405350243624") }},
+ {{ 8.5, static_cast<T>("-0.60201190268482361534842652295699870029606776360435523539636606145572515876770619546025351418378467287262574566665150299") }}
}};
max_err = 0;
for(unsigned k = 0; k < exact_data.size(); k++)
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 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -102,7 +102,7 @@
"4.4466189016791091516801723880812533528438597080549410911235655611382010503145789286158745555771483577943662768773465284793798720178177605712848440200402906836390133865748188969184005230383247111166918721449908133920663776952786683837038180436264738937354101153867171804315769471050303182129269442292354388037298125177941217926845803005587166270803697433886463469168814941555804311717400657004050157245e1110",
}};
- T eg = "5.77215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291746749514631447249807082480960504014486542836224173997644923536253500333742937337737673942792595258247094916008735203948165670853233151776611528621199501507984793745085705740029921354786146694029604325421519e-1";
+ T eg = static_cast<T>("5.77215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291746749514631447249807082480960504014486542836224173997644923536253500333742937337737673942792595258247094916008735203948165670853233151776611528621199501507984793745085705740029921354786146694029604325421519e-1");
unsigned max_err = 0;
for(unsigned k = 0; k < data.size(); k++)
Modified: sandbox/big_number/libs/multiprecision/test/test_cpp_int.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_cpp_int.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_cpp_int.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -72,10 +72,10 @@
int si = d.convert_to<int>();
unsigned ui = si;
- test_type a1 = a.str();
- test_type b1 = b.str();
- test_type c1 = c.str();
- test_type d1 = d.str();
+ test_type a1 = static_cast<test_type>(a.str());
+ test_type b1 = static_cast<test_type>(b.str());
+ test_type c1 = static_cast<test_type>(c.str());
+ test_type d1 = static_cast<test_type>(d.str());
BOOST_CHECK_EQUAL(a.str(), a1.str());
BOOST_CHECK_EQUAL(b.str(), b1.str());
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 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -102,7 +102,7 @@
"6.83336127500041943234365059231968669406267422759442985746460610830503287734479988530512309065240678799786759250323660701e3848",
}};
- T pi = "3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609";
+ T pi = static_cast<T>("3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609");
unsigned max_err = 0;
for(unsigned k = 0; k < data.size(); k++)
@@ -127,16 +127,16 @@
static const boost::array<boost::array<T, 2>, 10> exact_data =
{{
- {{ std::ldexp(1.0, -50), "1.00000000000000088817841970012562676935794497867573073630970950828771105957980924149923657574337470594698012676100224953" }},
- {{ std::ldexp(1.0, -20), "1.00000095367477115374544678824955687428365188553281789775169686343569285229334215539516690752571791280462887427635269562" }},
- {{ std::ldexp(1.0, -10), "1.00097703949241653524284529261160650646585162918174419940186408264916250428896869173656853690882467186075613761065459261" }},
- {{ 0.25, "1.28402541668774148407342056806243645833628086528146308921750729687220776586723800275330641943955356890166283174967968731" }},
- {{ 0.5, "1.64872127070012814684865078781416357165377610071014801157507931164066102119421560863277652005636664300286663775630779700" }},
- {{ 0.75, "2.11700001661267466854536981983709561013449158470240342177913303081098453336401282000279156026661579821888590471901551426" }},
- {{ 10, "22026.4657948067165169579006452842443663535126185567810742354263552252028185707925751991209681645258954515555010924578367" }},
- {{ 10.5, "36315.5026742466377389120269013166179689315579671275857607480190550842856628099187749764427758174866310742771977376827512" }},
- {{ 25, "7.20048993373858725241613514661261579152235338133952787362213864472320593107782569745000325654258093194727871848859163684e10" }},
- {{ 31.25, "3.72994612957188849046766396046821396700589012875701157893019118883826370993674081486706667149871508642909416337810227575e13" }},
+ {{ std::ldexp(1.0, -50), static_cast<T>("1.00000000000000088817841970012562676935794497867573073630970950828771105957980924149923657574337470594698012676100224953") }},
+ {{ std::ldexp(1.0, -20), static_cast<T>("1.00000095367477115374544678824955687428365188553281789775169686343569285229334215539516690752571791280462887427635269562") }},
+ {{ std::ldexp(1.0, -10), static_cast<T>("1.00097703949241653524284529261160650646585162918174419940186408264916250428896869173656853690882467186075613761065459261") }},
+ {{ 0.25, static_cast<T>("1.28402541668774148407342056806243645833628086528146308921750729687220776586723800275330641943955356890166283174967968731") }},
+ {{ 0.5, static_cast<T>("1.64872127070012814684865078781416357165377610071014801157507931164066102119421560863277652005636664300286663775630779700") }},
+ {{ 0.75, static_cast<T>("2.11700001661267466854536981983709561013449158470240342177913303081098453336401282000279156026661579821888590471901551426") }},
+ {{ 10, static_cast<T>("22026.4657948067165169579006452842443663535126185567810742354263552252028185707925751991209681645258954515555010924578367") }},
+ {{ 10.5, static_cast<T>("36315.5026742466377389120269013166179689315579671275857607480190550842856628099187749764427758174866310742771977376827512") }},
+ {{ 25, static_cast<T>("7.20048993373858725241613514661261579152235338133952787362213864472320593107782569745000325654258093194727871848859163684e10") }},
+ {{ 31.25, static_cast<T>("3.72994612957188849046766396046821396700589012875701157893019118883826370993674081486706667149871508642909416337810227575e13") }},
}};
max_err = 0;
Modified: sandbox/big_number/libs/multiprecision/test/test_float_io.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_float_io.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_float_io.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -172,18 +172,18 @@
BOOST_CHECK_EQUAL(val.str(), "-inf");
BOOST_CHECK_EQUAL(val.str(0, std::ios_base::showpos), "-inf");
- val = "inf";
+ val = static_cast<T>("inf");
BOOST_CHECK_EQUAL(val, std::numeric_limits<T>::infinity());
- val = "+inf";
+ val = static_cast<T>("+inf");
BOOST_CHECK_EQUAL(val, std::numeric_limits<T>::infinity());
- val = "-inf";
+ val = static_cast<T>("-inf");
BOOST_CHECK_EQUAL(val, -std::numeric_limits<T>::infinity());
}
if(std::numeric_limits<mp_t>::has_quiet_NaN)
{
T val = std::numeric_limits<T>::quiet_NaN();
BOOST_CHECK_EQUAL(val.str(), "nan");
- val = "nan";
+ val = static_cast<T>("nan");
BOOST_CHECK(boost::math::isnan(val));
}
}
@@ -246,9 +246,9 @@
#endif
ss.flags(f);
ss << val;
- T new_val = ss.str();
+ T new_val = static_cast<T>(ss.str());
BOOST_CHECK_EQUAL(new_val, val);
- new_val = val.str(0, f);
+ new_val = static_cast<T>(val.str(0, f));
BOOST_CHECK_EQUAL(new_val, val);
}
Modified: sandbox/big_number/libs/multiprecision/test/test_generic_conv.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_generic_conv.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_generic_conv.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -91,18 +91,18 @@
dec_float_500 tol("1e-500");
#ifdef TEST_GMP
mpf = df;
- mpf2 = df.str();
+ mpf2 = static_cast<mpf_type>(df.str());
BOOST_CHECK_EQUAL(mpf, mpf2);
df = mpf;
- df2 = mpf.str();
+ df2 = static_cast<dec_float_500>(mpf.str());
BOOST_CHECK(fabs((df - df2) / df) < tol);
#endif
#ifdef TEST_MPFR
mpfr = df;
- mpfr2 = df.str();
+ mpfr2 = static_cast<mpfr_type>(df.str());
BOOST_CHECK_EQUAL(mpfr, mpfr2);
df = mpfr;
- df2 = mpfr.str();
+ df2 = static_cast<dec_float_500>(mpfr.str());
BOOST_CHECK(fabs((df - df2) / df) < tol);
#endif
//
@@ -124,12 +124,12 @@
//
#ifdef TEST_GMP
mpq = c;
- mpq_rational mpq2 = c.str();
+ mpq_rational mpq2 = static_cast<mpq_rational>(c.str());
BOOST_CHECK_EQUAL(mpq, mpq2);
#endif
#ifdef TEST_TOMMATH
tr = c;
- tom_rational tr2 = c.str();
+ tom_rational tr2 = static_cast<tom_rational>(c.str());
BOOST_CHECK_EQUAL(tr, tr2);
#endif
//
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 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -101,13 +101,13 @@
rat = 2;
BOOST_TEST(mpz_int(rat) == 2);
iz = 3;
- iz = f0;
+ iz = static_cast<mpz_int>(f0);
BOOST_TEST(iz == 2);
iz = 3;
- iz = f50;
+ iz = static_cast<mpz_int>(f50);
BOOST_TEST(iz == 2);
iz = 3;
- iz = rat;
+ iz = static_cast<mpz_int>(rat);
BOOST_TEST(iz == 2);
BOOST_TEST(mpq_rational(mpz) == 2);
Modified: sandbox/big_number/libs/multiprecision/test/test_int_io.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_int_io.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_int_io.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -66,9 +66,9 @@
#endif
ss.flags(f);
ss << val;
- T new_val = ss.str();
+ T new_val = static_cast<T>(ss.str());
BOOST_CHECK_EQUAL(new_val, val);
- new_val = val.str(0, f);
+ new_val = static_cast<T>(val.str(0, f));
BOOST_CHECK_EQUAL(new_val, val);
}
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 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -152,7 +152,7 @@
"19.565410630120075532420489068555321524954362381908007338302983473268528473151341321768804731192210840056455228388636731122203200610869021021871133154865620432257415783302175345843898977949742849569372169004904667621738405749986270376895267386643049526766451459390277406632576412790748533372863644721976845168460840162066672290292749672668879524315410824251032084115058493720402881895485689493165441193",
}};
- T pi = "3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609";
+ T pi = static_cast<T>("3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609");
T tenth = 1;
tenth /= 10;
T logten = log(T(10));
Modified: sandbox/big_number/libs/multiprecision/test/test_rational_io.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_rational_io.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_rational_io.cpp 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -9,9 +9,10 @@
# define _SCL_SECURE_NO_WARNINGS
#endif
-#if !defined(TEST_MPQ) && !defined(TEST_TOMMATH)
+#if !defined(TEST_MPQ) && !defined(TEST_TOMMATH) && !defined(TEST_CPP_INT)
# define TEST_MPQ
# define TEST_TOMMATH
+# define TEST_CPP_INT
#ifdef _MSC_VER
#pragma message("CAUTION!!: No backend type specified so testing everything.... this will take some time!!")
@@ -28,6 +29,9 @@
#if defined(TEST_TOMMATH)
#include <boost/multiprecision/tommath.hpp>
#endif
+#ifdef TEST_CPP_INT
+#include <boost/multiprecision/cpp_int.hpp>
+#endif
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/random/mersenne_twister.hpp>
@@ -71,9 +75,9 @@
#endif
ss.flags(f);
ss << val;
- T new_val = ss.str();
+ T new_val = static_cast<T>(ss.str());
BOOST_CHECK_EQUAL(new_val, val);
- new_val = val.str(0, f);
+ new_val = static_cast<T>(val.str(0, f));
BOOST_CHECK_EQUAL(new_val, val);
}
@@ -133,6 +137,10 @@
test_round_trip<boost::rational<boost::multiprecision::tom_int> >();
test_round_trip<boost::multiprecision::tom_rational >();
#endif
+#ifdef TEST_CPP_INT
+ test_round_trip<boost::rational<boost::multiprecision::cpp_int> >();
+ test_round_trip<boost::multiprecision::cpp_rational >();
+#endif
return boost::report_errors();
}
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 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -155,7 +155,7 @@
boost::uintmax_t max_err = 0;
for(unsigned k = 0; k < data.size(); k++)
{
- static const T euler_gamma = "5.77215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291746749514631447249807082480960504014486542836224173997644923536253500333742937337737673942792595258247094916008735203948165670853233151776611528621199501507984793745085705740029921354786146694029604325421519e-1";
+ static const T euler_gamma = static_cast<T>("5.77215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291746749514631447249807082480960504014486542836224173997644923536253500333742937337737673942792595258247094916008735203948165670853233151776611528621199501507984793745085705740029921354786146694029604325421519e-1");
T val = sin(euler_gamma * ((100 * k) - 5000));
T e = relative_error(val, T(data[k]));
unsigned err = e.template convert_to<unsigned>();
@@ -228,7 +228,7 @@
max_err = 0;
for(unsigned k = 0; k < small_data.size(); k++)
{
- static const T euler_gamma = "5.77215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291746749514631447249807082480960504014486542836224173997644923536253500333742937337737673942792595258247094916008735203948165670853233151776611528621199501507984793745085705740029921354786146694029604325421519e-1";
+ static const T euler_gamma = static_cast<T>("5.77215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291746749514631447249807082480960504014486542836224173997644923536253500333742937337737673942792595258247094916008735203948165670853233151776611528621199501507984793745085705740029921354786146694029604325421519e-1");
T val = sin((euler_gamma + k) / 53);
T e = relative_error(val, T(small_data[k]));
unsigned err = e.template convert_to<unsigned>();
@@ -252,15 +252,15 @@
//
static const boost::array<boost::array<T, 2>, 9> exact_data =
{{
- {{ 0.5, "0.479425538604203000273287935215571388081803367940600675188616613125535000287814832209631274684348269086132091084505717418" }},
- {{ 0.25, "0.247403959254522929596848704849389195893390980386965810676544830494398136043486821690984848527973792338327197752176516138" }},
- {{0.75, "0.681638760023334166733241952779893935338382394659229909213625262151100388887003782753145274849781911981438190343146876189" }},
- {{std::ldexp(1.0, -20), "9.53674316406105439710335272649306549801506698739838753888815787489707114648106832493113326022411646219016312547902694921e-7" }},
- {{ 2, "0.909297426825681695396019865911744842702254971447890268378973011530967301540783544620126688924959380309967896742399486261" }},
- {{ 5, "-0.958924274663138468893154406155993973352461543964601778131672454235102558086559603076995955429532866596530638461663378937" }},
- {{ 10, "-0.544021110889369813404747661851377281683643012916223891574184012616757209640493425707075673894983216158293824238262832286" }},
+ {{ 0.5, static_cast<T>("0.479425538604203000273287935215571388081803367940600675188616613125535000287814832209631274684348269086132091084505717418") }},
+ {{ 0.25, static_cast<T>("0.247403959254522929596848704849389195893390980386965810676544830494398136043486821690984848527973792338327197752176516138") }},
+ {{0.75, static_cast<T>("0.681638760023334166733241952779893935338382394659229909213625262151100388887003782753145274849781911981438190343146876189") }},
+ {{std::ldexp(1.0, -20), static_cast<T>("9.53674316406105439710335272649306549801506698739838753888815787489707114648106832493113326022411646219016312547902694921e-7") }},
+ {{ 2, static_cast<T>("0.909297426825681695396019865911744842702254971447890268378973011530967301540783544620126688924959380309967896742399486261") }},
+ {{ 5, static_cast<T>("-0.958924274663138468893154406155993973352461543964601778131672454235102558086559603076995955429532866596530638461663378937") }},
+ {{ 10, static_cast<T>("-0.544021110889369813404747661851377281683643012916223891574184012616757209640493425707075673894983216158293824238262832286") }},
{{ 0, 0 }},
- {{ "1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404325664115332354692230477529111586267970406424055872514205135096926055277982231147447746519098221440548783296672306423782411689339158263560095457282428346173017430522716332410669680363012457064", 1 }}
+ {{ static_cast<T>("1.57079632679489661923132169163975144209858469968755291048747229615390820314310449931401741267105853399107404325664115332354692230477529111586267970406424055872514205135096926055277982231147447746519098221440548783296672306423782411689339158263560095457282428346173017430522716332410669680363012457064"), 1 }}
}};
max_err = 0;
for(unsigned k = 0; k < exact_data.size(); k++)
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 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -102,7 +102,7 @@
"4.4466189016791091516801723880812533528438597080549410911235655611382010503145789286158745555771483577943662768773465284793798720178177605712848440200402906836390133865748188969184005230383247111166918721449908133920663776952786683837038180436264738937354101153867171804315769471050303182129269442292354388037298125177941217926845803005587166270803697433886463469168814941555804311717400657004050157245e1110",
}};
- T eg = "5.77215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291746749514631447249807082480960504014486542836224173997644923536253500333742937337737673942792595258247094916008735203948165670853233151776611528621199501507984793745085705740029921354786146694029604325421519e-1";
+ T eg = static_cast<T>("5.77215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291746749514631447249807082480960504014486542836224173997644923536253500333742937337737673942792595258247094916008735203948165670853233151776611528621199501507984793745085705740029921354786146694029604325421519e-1");
unsigned max_err = 0;
for(unsigned k = 0; k < data.size(); k++)
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 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -152,7 +152,7 @@
"17.72453850905516027298167483341145182797549456122387128213807789852911284591032181374950656738544665416226823624282570666236152865724422602525093709602787068462037698653105122849925173028950826228932095379267962800174639015351479720516700190185234018585446974494912640313921775525906216405419332500906398407613733477475153433667989789365851836408795451165161738760059067393431791332809854846248184902054654852195613251561647467515042738761056107996127107210060372044483672365296613708094323498831668424213845709609120420427785778068694766570005218305685125413396636944654181510716693883321942929357062268865224420542149948049920756486398874838505930640218214029285811233064978945203621149078962287389403245978198513134871266512506293260044656382109675026812496930595420461560761952217391525070207792758099054332900662223067614469661248188743069978835205061464443854185307973574257179185635959749959952263849242203889103966406447293972841345043002140564233433039261756134176336320017037654163476320669276541812
83576249032690450848532013419243598973087119379948293873011126256165881888478597787596376136",
}};
- T pi = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572
0106548586327886593615338182796823030195203530185296899577362259941389124972177528347913152";
+ T pi = static_cast<T>("3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164
2019893809525720106548586327886593615338182796823030195203530185296899577362259941389124972177528347913152");
unsigned max_err = 0;
for(unsigned k = 0; k < data.size(); k++)
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 2012-08-16 04:13:51 EDT (Thu, 16 Aug 2012)
@@ -102,7 +102,7 @@
"1.",
}};
- T eg = "5.77215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291746749514631447249807082480960504014486542836224173997644923536253500333742937337737673942792595258247094916008735203948165670853233151776611528621199501507984793745085705740029921354786146694029604325421519e-1";
+ T eg = static_cast<T>("5.77215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291746749514631447249807082480960504014486542836224173997644923536253500333742937337737673942792595258247094916008735203948165670853233151776611528621199501507984793745085705740029921354786146694029604325421519e-1");
unsigned max_err = 0;
for(unsigned k = 0; k < data.size(); k++)
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