Tighten up and test the architypes.

[SVN r75404]
This commit is contained in:
John Maddock
2011-11-08 12:50:21 +00:00
parent fb0acf6872
commit b36be1f5c3
4 changed files with 80 additions and 103 deletions

View File

@@ -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_backend_float_architype> mp_number_float_architype;

View File

@@ -340,18 +340,18 @@ void eval_abs(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 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>

View File

@@ -158,6 +158,38 @@ run mp_number_concept_check.cpp mpfr
[ 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 @@ run mp_number_concept_check.cpp
: # 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

View File

@@ -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 @@ void foo()
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>));