Boost logo

Boost Users :

Subject: [Boost-users] Regarding boost interval library package.
From: Pranjal vyas (pranjalvyas20_at_[hidden])
Date: 2013-06-15 06:49:36


Hello,

I have written a program in boost which simply calculates the exponent in
an interval, but for some interval inputs it is giving the wrong output
such as for [1,3] or [-1,3]...but for some values it is giving correct o/p
such as [1,9]. Please help in solving this query.

The program is appended below....
*********************************************************************************************************************************************************
#include </boost/numeric/interval.hpp>
#include <vector>
#include <algorithm>
#include <utility>
#include <iostream>
#include <iomanip>
#include <math.h>

 using namespace boost;
  using namespace numeric;
  using namespace interval_lib;

template<class T, class Policies>
std::ostream &operator<<(std::ostream &os,
                         const boost::numeric::interval<T, Policies> &x) {
  os << "[" << x.lower() << ", " << x.upper() << "]";
  return os;
}

int main()
{

  typedef interval<double,policies<save_state<rounded_transc_opp<double>
>,checking_base<double> > > I;
  //typedef interval<double> I;
  I a(1,3.2);
  std::cout << exp(a) << std::endl;

}
**********************************************************************************************************************************************************

Thanks in Advance.
Regards,
PV



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net