Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/numeric/interval/test/pow.cpp @ 30

Last change on this file since 30 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.2 KB
Line 
1/* Boost test/pow.cpp
2 * test the pow function
3 *
4 * Copyright 2002-2003 Guillaume Melquiond
5 *
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)
9 */
10
11#include <boost/numeric/interval.hpp>
12#include <boost/test/minimal.hpp>
13#include "bugs.hpp"
14
15bool 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;
19}
20
21int test_main(int, char *[]) {
22  BOOST_CHECK(test_pow(2, 3, 8, 27, 3));
23  BOOST_CHECK(test_pow(2, 3, 16, 81, 4));
24  BOOST_CHECK(test_pow(-3, 2, -27, 8, 3));
25  BOOST_CHECK(test_pow(-3, 2, 0, 81, 4));
26  BOOST_CHECK(test_pow(-3, -2, -27, -8, 3));
27  BOOST_CHECK(test_pow(-3, -2, 16, 81, 4));
28
29  BOOST_CHECK(test_pow(2, 4, 1./64, 1./8, -3));
30  BOOST_CHECK(test_pow(2, 4, 1./256, 1./16, -4));
31  BOOST_CHECK(test_pow(-4, -2, -1./8, -1./64, -3));
32  BOOST_CHECK(test_pow(-4, -2, 1./256, 1./16, -4));
33
34  BOOST_CHECK(test_pow(2, 3, 1, 1, 0));
35  BOOST_CHECK(test_pow(-3, 2, 1, 1, 0));
36  BOOST_CHECK(test_pow(-3, -2, 1, 1, 0));
37
38# ifdef __BORLANDC__
39  ::detail::ignore_warnings();
40# endif
41  return 0;
42}
Note: See TracBrowser for help on using the repository browser.