mirror of
https://github.com/boostorg/multiprecision.git
synced 2026-02-12 12:12:26 +00:00
Add a few non-member functions for real-valued types.
Add minimal docs. [SVN r73608]
This commit is contained in:
@@ -60,6 +60,25 @@ void test_integer_ops(const boost::mpl::true_&)
|
||||
BOOST_TEST(a == -20 % -7);
|
||||
}
|
||||
|
||||
template <class Real>
|
||||
void test_real_ops(const boost::mpl::false_&){}
|
||||
|
||||
template <class Real>
|
||||
void test_real_ops(const boost::mpl::true_&)
|
||||
{
|
||||
std::cout << "Root2 = " << sqrt(Real(2)) << std::endl;
|
||||
BOOST_TEST(abs(Real(2)) == 2);
|
||||
BOOST_TEST(abs(Real(-2)) == 2);
|
||||
BOOST_TEST(fabs(Real(2)) == 2);
|
||||
BOOST_TEST(fabs(Real(-2)) == 2);
|
||||
BOOST_TEST(floor(Real(5) / 2) == 2);
|
||||
BOOST_TEST(ceil(Real(5) / 2) == 3);
|
||||
BOOST_TEST(floor(Real(-5) / 2) == -3);
|
||||
BOOST_TEST(ceil(Real(-5) / 2) == -2);
|
||||
BOOST_TEST(trunc(Real(5) / 2) == 2);
|
||||
BOOST_TEST(trunc(Real(-5) / 2) == -2);
|
||||
}
|
||||
|
||||
template <class Real, class Num>
|
||||
void test_negative_mixed(boost::mpl::true_ const&)
|
||||
{
|
||||
@@ -209,6 +228,10 @@ void test()
|
||||
//
|
||||
test_integer_ops<Real>(boost::math::is_extended_integer<Real>());
|
||||
//
|
||||
// Real number only functions:
|
||||
//
|
||||
test_real_ops<Real>(boost::mpl::bool_<false == boost::math::is_extended_integer<Real>::value >());
|
||||
//
|
||||
// Test basic arithmetic:
|
||||
//
|
||||
Real a(8);
|
||||
|
||||
Reference in New Issue
Block a user