Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75404 - in sandbox/big_number: boost/multiprecision/concepts boost/multiprecision/detail libs/multiprecision/test
From: john_at_[hidden]
Date: 2011-11-08 07:50:22


Author: johnmaddock
Date: 2011-11-08 07:50:21 EST (Tue, 08 Nov 2011)
New Revision: 75404
URL: http://svn.boost.org/trac/boost/changeset/75404

Log:
Tighten up and test the architypes.
Text files modified:
   sandbox/big_number/boost/multiprecision/concepts/mp_number_architypes.hpp | 82 ---------------------------------------
   sandbox/big_number/boost/multiprecision/detail/default_ops.hpp | 8 +-
   sandbox/big_number/libs/multiprecision/test/Jamfile.v2 | 40 +++++++++++++++++++
   sandbox/big_number/libs/multiprecision/test/mp_number_concept_check.cpp | 53 +++++++++++++++++--------
   4 files changed, 80 insertions(+), 103 deletions(-)

Modified: sandbox/big_number/boost/multiprecision/concepts/mp_number_architypes.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/concepts/mp_number_architypes.hpp (original)
+++ sandbox/big_number/boost/multiprecision/concepts/mp_number_architypes.hpp 2011-11-08 07:50:21 EST (Tue, 08 Nov 2011)
@@ -177,94 +177,14 @@
    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_backend_float_architype> mp_number_float_architype;

Modified: sandbox/big_number/boost/multiprecision/detail/default_ops.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/default_ops.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/default_ops.hpp 2011-11-08 07:50:21 EST (Tue, 08 Nov 2011)
@@ -340,18 +340,18 @@
 {
    typedef typename T::signed_types type_list;
    typedef typename mpl::front<type_list>::type front;
- *result = arg;
+ result = arg;
    if(arg.compare(front(0)) < 0)
- result->negate();
+ result.negate();
 }
 template <class T>
 void eval_fabs(T& result, const T& arg)
 {
    typedef typename T::signed_types type_list;
    typedef typename mpl::front<type_list>::type front;
- *result = arg;
+ result = arg;
    if(arg.compare(front(0)) < 0)
- result->negate();
+ result.negate();
 }
 
 template <class Backend>

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 2011-11-08 07:50:21 EST (Tue, 08 Nov 2011)
@@ -158,6 +158,38 @@
          [ check-target-builds ../config//has_mpfr : : <build>no ]
         : big_number_concept_check_mpfr_50 ;
 
+run mp_number_concept_check.cpp mpfr
+ : # command line
+ : # input files
+ : # requirements
+ <define>TEST_MPFR_6
+ [ check-target-builds ../config//has_mpfr : : <build>no ]
+ : big_number_concept_check_mpfr_6 ;
+
+run mp_number_concept_check.cpp mpfr
+ : # command line
+ : # input files
+ : # requirements
+ <define>TEST_MPFR_15
+ [ check-target-builds ../config//has_mpfr : : <build>no ]
+ : big_number_concept_check_mpfr_15 ;
+
+run mp_number_concept_check.cpp mpfr
+ : # command line
+ : # input files
+ : # requirements
+ <define>TEST_MPFR_17
+ [ check-target-builds ../config//has_mpfr : : <build>no ]
+ : big_number_concept_check_mpfr_17 ;
+
+run mp_number_concept_check.cpp mpfr
+ : # command line
+ : # input files
+ : # requirements
+ <define>TEST_MPFR_30
+ [ check-target-builds ../config//has_mpfr : : <build>no ]
+ : big_number_concept_check_mpfr_30 ;
+
 run mp_number_concept_check.cpp gmp
         : # command line
         : # input files
@@ -171,9 +203,15 @@
         : # input files
         : # requirements
               <define>TEST_MP_FLOAT
- [ check-target-builds ../config//has_gmp : : <build>no ]
         : big_number_concept_check_mp_float ;
 
+run mp_number_concept_check.cpp
+ : # command line
+ : # input files
+ : # requirements
+ <define>TEST_BACKEND
+ : big_number_concept_check_backend_concept ;
+
 run test_exp.cpp gmp
         : # command line
         : # input files

Modified: sandbox/big_number/libs/multiprecision/test/mp_number_concept_check.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/mp_number_concept_check.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/mp_number_concept_check.cpp 2011-11-08 07:50:21 EST (Tue, 08 Nov 2011)
@@ -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 <boost/multiprecision/gmp.hpp>
 #endif
 #ifdef TEST_BACKEND
@@ -47,7 +51,7 @@
 #ifdef TEST_MP_FLOAT
 #include <boost/multiprecision/mp_float.hpp>
 #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 <boost/multiprecision/mpfr.hpp>
 #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<boost::multiprecision::mpfr_float_backend<6> >());
+#endif
+#ifdef TEST_MPFR_15
+ instantiate(boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<15> >());
+#endif
+#ifdef TEST_MPFR_17
+ instantiate(boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<17> >());
+#endif
+#ifdef TEST_MPFR_30
+ instantiate(boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<30> >());
 #endif
 #ifdef TEST_MP_FLOAT
    instantiate(boost::multiprecision::mp_float_50());
@@ -79,19 +89,28 @@
 int main()
 {
 #ifdef TEST_BACKEND
- BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept<boost::math::concepts::mp_number_float_architype>));
+ BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept<boost::multiprecision::concepts::mp_number_float_architype>));
 #endif
 #ifdef TEST_MPF_50
    BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept<boost::multiprecision::mpf_float_50>));
 #endif
-#ifdef TEST_MPF
- BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept<boost::multiprecision::mpf_float>));
-#endif
 #ifdef TEST_MPFR_50
    BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept<boost::multiprecision::mpfr_float_50>));
 #endif
-#ifdef TEST_MPFR
- BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept<boost::multiprecision::mpfr_float>));
+#ifdef TEST_MPFR_6
+ BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept<boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<6> > >));
+#endif
+#ifdef TEST_MPFR_15
+ BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept<boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<15> > >));
+#endif
+#ifdef TEST_MPFR_17
+ BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept<boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<17> > >));
+#endif
+#ifdef TEST_MPFR_30
+ BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept<boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<30> > >));
+#endif
+#ifdef TEST_MPFR_50
+ BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept<boost::multiprecision::mpfr_float_50>));
 #endif
 #ifdef TEST_MP_FLOAT
    BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept<boost::multiprecision::mp_float_50>));


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