]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/numeric/interval/test/pow.cpp
2 * test the pow function
4 * Copyright 2002-2003 Guillaume Melquiond
6 * Distributed under the Boost Software License, Version 1.0.
7 * (See accompanying file LICENSE_1_0.txt or
8 * copy at http://www.boost.org/LICENSE_1_0.txt)
11 #include <boost/numeric/interval.hpp>
12 #include <boost/core/lightweight_test.hpp>
15 bool test_pow(double al
, double au
, double bl
, double bu
, int p
) {
16 typedef boost::numeric::interval
<double> I
;
17 I b
= pow(I(al
, au
), p
);
18 return b
.lower() == bl
&& b
.upper() == bu
;
22 BOOST_TEST(test_pow(2, 3, 8, 27, 3));
23 BOOST_TEST(test_pow(2, 3, 16, 81, 4));
24 BOOST_TEST(test_pow(-3, 2, -27, 8, 3));
25 BOOST_TEST(test_pow(-3, 2, 0, 81, 4));
26 BOOST_TEST(test_pow(-3, -2, -27, -8, 3));
27 BOOST_TEST(test_pow(-3, -2, 16, 81, 4));
29 BOOST_TEST(test_pow(2, 4, 1./64, 1./8, -3));
30 BOOST_TEST(test_pow(2, 4, 1./256, 1./16, -4));
31 BOOST_TEST(test_pow(-4, -2, -1./8, -1./64, -3));
32 BOOST_TEST(test_pow(-4, -2, 1./256, 1./16, -4));
34 BOOST_TEST(test_pow(2, 3, 1, 1, 0));
35 BOOST_TEST(test_pow(-3, 2, 1, 1, 0));
36 BOOST_TEST(test_pow(-3, -2, 1, 1, 0));
38 # ifdef BOOST_BORLANDC
39 ::detail::ignore_warnings();
41 return boost::report_errors();