| 1 |
|
|---|
| 2 | #include <iostream>
|
|---|
| 3 | #include <boost/numeric/interval.hpp>
|
|---|
| 4 | #include <cmath>
|
|---|
| 5 |
|
|---|
| 6 | using namespace std;
|
|---|
| 7 | using namespace boost::numeric;
|
|---|
| 8 | using namespace boost::numeric::interval_lib;
|
|---|
| 9 |
|
|---|
| 10 | template<class T, class Policies>
|
|---|
| 11 | ostream& operator <<(std::ostream &os,const interval<T, Policies> &i) {
|
|---|
| 12 | return os << "[" << i.lower() << "," << i.upper() << "]" << endl;
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | int 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 | };
|
|---|