Ticket #2769: interval_test.cpp

File interval_test.cpp, 703 bytes (added by anonymous, 14 years ago)

c++-File depicting the problem

Line 
1
2#include <iostream>
3#include <boost/numeric/interval.hpp>
4#include <cmath>
5
6using namespace std;
7using namespace boost::numeric;
8using namespace boost::numeric::interval_lib;
9
10template<class T, class Policies>
11ostream& operator <<(std::ostream &os,const interval<T, Policies> &i) {
12 return os << "[" << i.lower() << "," << i.upper() << "]" << endl;
13}
14
15int main(void) {
16 typedef boost::numeric::interval<double, policies<save_state<rounded_transc_std<double> >, checking_base<double> > > I;
17
18 I alpha;
19
20 alpha.assign(-2.1, -2.1);
21 cout << "sin(alpha) = " << sin(alpha) << endl;
22
23 alpha.assign(-2.1 - M_PI / 2.0, -2.1 - M_PI / 2.0);
24 cout << "cos(alpha) = " << cos(alpha);
25
26 return 0;
27};