Open NAThompson opened 6 years ago
I have reproduced this locally; it appears that none of the rounding policies provide cos_down
(and cos_up
, and others).
This functionality has been missing for a long time.
For transcendental functions, you need to specify the rounding policy. For example:
typedef boost::numeric::interval<
double,
boost::numeric::interval_lib::policies<
boost::numeric::interval_lib::save_state<
boost::numeric::interval_lib::rounded_transc_std<double> >,
boost::numeric::interval_lib::checking_base<double> > >
Interval;
Read more about the rounding policy for transcendental functions here.
The above solution didn't work for me. But I found a working example here: https://stackoverflow.com/questions/47488323/boost-interval-with-multiprecision
#include <iostream>
#include <boost/numeric/interval.hpp>
#include <boost/numeric/interval/io.hpp>
namespace bn = boost::numeric;
namespace bni = bn::interval_lib;
template <typename T>
using Interval = bn::interval<T, bni::policies<bni::save_state<bni::rounded_transc_exact<T>>, bni::checking_base<T>>>;
int main() {
Interval<double> x(0.1, 0.2);
Interval<double> y = sin(x);
std::cout << y << std::endl; // [0.0998334,0.198669]
}
Code to reproduce:
Error message:
Compiled against a fresh clone.