Subject: [Boost-bugs] [Boost C++ Libraries] #5498: Issues with the Interval Library
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-04-23 09:11:20
#5498: Issues with the Interval Library
-------------------------------+--------------------------------------------
Reporter: dduffy@⦠| Owner: bgubenko
Type: Bugs | Status: new
Milestone: Boost 1.46.0 | Component: interval
Version: Boost 1.46.0 | Severity: Showstopper
Keywords: Interval |
-------------------------------+--------------------------------------------
I am trying to compile some examples; in particular, the trigonometric,
hyperbolic trig and transendental (exp, log!!)functions don't compile with
default roudning policy (see file I included). It's a kind of show-
stopper.
Some user requests as well are:
1. Instead of bool when comparing interval, use TriBool (a result can be
_indeterminate_)
2. Interval is missing midpoint() (same as median()).
3. Interval analysis is highly specialised; more user examples would be
very welcome.
I have the books by R.E. Moore but it takes some time to map his results
to Interval.
best regards
Daniel
// Code
// TestInterval101.cpp
//
// Tests for Interval arithmetic.
//
// (C) Datasim Education BV 2009-2011
#include <boost/numeric/interval.hpp>
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;
}
typedef boost::numeric::interval<double> Range;
int main()
{
using namespace boost::numeric;
// Create and manipulate some numbers.
Range r1(0.0, 1,0);
Range r2(-10.0, 20.0);
Range r3(20.8, 44.9);
double t = 2.0;
r1 += t; r1 -= t; r1 *= t; r1 /= t;
Range rTmp(2.0, 3.0);
r1 += rTmp; r1 -= rTmp; r1 *= rTmp; r1 /= rTmp;
// Numeric operations.
Range r4 = r1 + r2;
Range r5 = r1 - r2;
Range r6 = r1 * r2;
Range r7 = r1 / r2;
// More numeric operations.
t = 3.0;
r4 = r1 + t;
r5 = r1 - t;
r6 = r1 * t;
r7 = r1 / t;
// Algebraic functions.
r4 = abs(r1);
r5 = sqrt(r2);
r6 = square(r3);
r7 = pow(r1, 2); // r1^2
Range r8 = nth_root(r1, 4);
// NONE COMPILES
// Transcendental functions
// r4 = exp(r1);
// boost::numeric::interval<double,
boost::numeric::interval_lib::default_policies<double> > myI;
// myI = boost::numeric::exp(myI);
//r5 = log(r2);
// Trigonometric functions
/* r4 = sin(r1);
r5 = cos(r1);
r6 = tan(r1);
r7 = asin(r2);
r7 = acos(r2);
r7 = atan(r2);
// Hyperbolic trigonometric functions
r4 = sinh(r1);
r5 = cosh(r1);
r6 = tanh(r1);
r7 = asinh(r2);
r8 = acosh(r2);
r6 = atanh(r2);*/
return 0;
}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5498> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:06 UTC