diff --git a/include/boost/multiprecision/concepts/mp_number_architypes.hpp b/include/boost/multiprecision/concepts/mp_number_architypes.hpp index da417ae1..accd293d 100644 --- a/include/boost/multiprecision/concepts/mp_number_architypes.hpp +++ b/include/boost/multiprecision/concepts/mp_number_architypes.hpp @@ -177,94 +177,14 @@ inline void eval_ceil(mp_number_backend_float_architype& result, const mp_number result = std::ceil(arg.m_value); } -inline void eval_trunc(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& arg) -{ - result = boost::math::trunc(arg.m_value); -} - inline void eval_sqrt(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& arg) { result = std::sqrt(arg.m_value); } -inline void eval_abs(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& arg) -{ - result = std::abs(arg.m_value); -} - -inline void eval_fabs(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& arg) -{ - result = std::fabs(arg.m_value); -} - inline int eval_fpclassify(const mp_number_backend_float_architype& arg) { - return boost::math::fpclassify(arg.m_value); -} - -inline void eval_pow(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& b, const mp_number_backend_float_architype& e) -{ - result = std::pow(b.m_value, e.m_value); -} - -inline void eval_pow(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& b, int e) -{ - result = std::pow(b.m_value, e); -} - -inline void eval_exp(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& arg) -{ - result = std::exp(arg.m_value); -} - -inline void eval_log(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& arg) -{ - result = std::log(arg.m_value); -} - -inline void eval_sin(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& arg) -{ - result = std::sin(arg.m_value); -} - -inline void eval_cos(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& arg) -{ - result = std::cos(arg.m_value); -} - -inline void eval_tan(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& arg) -{ - result = std::tan(arg.m_value); -} - -inline void eval_asin(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& arg) -{ - result = std::asin(arg.m_value); -} - -inline void eval_acos(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& arg) -{ - result = std::acos(arg.m_value); -} - -inline void eval_atan(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& arg) -{ - result = std::atan(arg.m_value); -} - -inline void eval_sinh(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& arg) -{ - result = std::sinh(arg.m_value); -} - -inline void eval_cosh(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& arg) -{ - result = std::cosh(arg.m_value); -} - -inline void eval_tanh(mp_number_backend_float_architype& result, const mp_number_backend_float_architype& arg) -{ - result = std::tanh(arg.m_value); + return (boost::math::fpclassify)(arg.m_value); } typedef boost::multiprecision::mp_number mp_number_float_architype; diff --git a/include/boost/multiprecision/detail/default_ops.hpp b/include/boost/multiprecision/detail/default_ops.hpp index ed82327c..91bed7f5 100644 --- a/include/boost/multiprecision/detail/default_ops.hpp +++ b/include/boost/multiprecision/detail/default_ops.hpp @@ -340,18 +340,18 @@ void eval_abs(T& result, const T& arg) { typedef typename T::signed_types type_list; typedef typename mpl::front::type front; - *result = arg; + result = arg; if(arg.compare(front(0)) < 0) - result->negate(); + result.negate(); } template void eval_fabs(T& result, const T& arg) { typedef typename T::signed_types type_list; typedef typename mpl::front::type front; - *result = arg; + result = arg; if(arg.compare(front(0)) < 0) - result->negate(); + result.negate(); } template diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 9ee8b530..7855a726 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -158,6 +158,38 @@ run mp_number_concept_check.cpp mpfr [ check-target-builds ../config//has_mpfr : : no ] : big_number_concept_check_mpfr_50 ; +run mp_number_concept_check.cpp mpfr + : # command line + : # input files + : # requirements + TEST_MPFR_6 + [ check-target-builds ../config//has_mpfr : : no ] + : big_number_concept_check_mpfr_6 ; + +run mp_number_concept_check.cpp mpfr + : # command line + : # input files + : # requirements + TEST_MPFR_15 + [ check-target-builds ../config//has_mpfr : : no ] + : big_number_concept_check_mpfr_15 ; + +run mp_number_concept_check.cpp mpfr + : # command line + : # input files + : # requirements + TEST_MPFR_17 + [ check-target-builds ../config//has_mpfr : : no ] + : big_number_concept_check_mpfr_17 ; + +run mp_number_concept_check.cpp mpfr + : # command line + : # input files + : # requirements + TEST_MPFR_30 + [ check-target-builds ../config//has_mpfr : : no ] + : big_number_concept_check_mpfr_30 ; + run mp_number_concept_check.cpp gmp : # command line : # input files @@ -171,9 +203,15 @@ run mp_number_concept_check.cpp : # input files : # requirements TEST_MP_FLOAT - [ check-target-builds ../config//has_gmp : : no ] : big_number_concept_check_mp_float ; +run mp_number_concept_check.cpp + : # command line + : # input files + : # requirements + TEST_BACKEND + : big_number_concept_check_backend_concept ; + run test_exp.cpp gmp : # command line : # input files diff --git a/test/mp_number_concept_check.cpp b/test/mp_number_concept_check.cpp index 99d2c13f..35872d75 100644 --- a/test/mp_number_concept_check.cpp +++ b/test/mp_number_concept_check.cpp @@ -20,13 +20,17 @@ # pragma warning(disable:4503) // decorated name length exceeded, name was truncated #endif -#if !defined(TEST_MPF_50) && !defined(TEST_MPF) && !defined(TEST_BACKEND) && !defined(TEST_MPZ) && !defined(TEST_MP_FLOAT) && !defined(TEST_MPFR) && !defined(TEST_MPFR_50) +#if !defined(TEST_MPF_50) && !defined(TEST_BACKEND) && !defined(TEST_MPZ) \ + && !defined(TEST_MP_FLOAT) && !defined(TEST_MPFR_50)\ + && !defined(TEST_MPFR_6) && !defined(TEST_MPFR_15) && !defined(TEST_MPFR_17) && !defined(TEST_MPFR_30) # define TEST_MPF_50 -# define TEST_MPF # define TEST_BACKEND # define TEST_MPZ -# define TEST_MPFR # define TEST_MPFR_50 +# define TEST_MPFR_6 +# define TEST_MPFR_15 +# define TEST_MPFR_17 +# define TEST_MPFR_30 # define TEST_MP_FLOAT #ifdef _MSC_VER @@ -38,7 +42,7 @@ #endif -#if defined(TEST_MPF_50) || defined(TEST_MPF) || defined(TEST_MPZ) +#if defined(TEST_MPF_50) || defined(TEST_MPZ) #include #endif #ifdef TEST_BACKEND @@ -47,7 +51,7 @@ #ifdef TEST_MP_FLOAT #include #endif -#if defined(TEST_MPFR) || defined(TEST_MPFR_50) +#if defined(TEST_MPFR_50) || defined(TEST_MPFR_6) || defined(TEST_MPFR_15) || defined(TEST_MPFR_17) || defined(TEST_MPFR_30) #include #endif @@ -57,19 +61,25 @@ void foo() { #ifdef TEST_BACKEND - instantiate(boost::multiprecision::mp_number_float_architype()); + instantiate(boost::multiprecision::concepts::mp_number_float_architype()); #endif #ifdef TEST_MPF_50 instantiate(boost::multiprecision::mpf_float_50()); #endif -#ifdef TEST_MPF - instantiate(boost::multiprecision::mpf_float()); -#endif #ifdef TEST_MPFR_50 instantiate(boost::multiprecision::mpfr_float_50()); #endif -#ifdef TEST_MPFR - instantiate(boost::multiprecision::mpfr_float()); +#ifdef TEST_MPFR_6 + instantiate(boost::multiprecision::mp_number >()); +#endif +#ifdef TEST_MPFR_15 + instantiate(boost::multiprecision::mp_number >()); +#endif +#ifdef TEST_MPFR_17 + instantiate(boost::multiprecision::mp_number >()); +#endif +#ifdef TEST_MPFR_30 + instantiate(boost::multiprecision::mp_number >()); #endif #ifdef TEST_MP_FLOAT instantiate(boost::multiprecision::mp_float_50()); @@ -79,19 +89,28 @@ void foo() int main() { #ifdef TEST_BACKEND - BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept)); + BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept)); #endif #ifdef TEST_MPF_50 BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept)); #endif -#ifdef TEST_MPF - BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept)); -#endif #ifdef TEST_MPFR_50 BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept)); #endif -#ifdef TEST_MPFR - BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept)); +#ifdef TEST_MPFR_6 + BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept > >)); +#endif +#ifdef TEST_MPFR_15 + BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept > >)); +#endif +#ifdef TEST_MPFR_17 + BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept > >)); +#endif +#ifdef TEST_MPFR_30 + BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept > >)); +#endif +#ifdef TEST_MPFR_50 + BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept)); #endif #ifdef TEST_MP_FLOAT BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept));