Hi, I came across a likely bug in boost::numeric::tan(interval) today. Calling tan on an interval with a save_state rounding policy fails to compile on line 109 of transc.hpp, even though an interval with a save_state_nothing policy compiles correctly. I think this is because of a typo; the line R tmp = fmod((const I&)x, pi); was probably meant to read R tmp = fmod((const R&)x, pi); so that the call to fmod isn't ambiguous (why gcc didn't tell me it was ambiguous, I can't tell). It presumably works with save_state_nothing because it's equivalent to the unprotected version.
I've attached a test case, and the output produced by g++-3.3. Jason McCarty
#include <boost/numeric/interval.hpp> int main () { using namespace boost::numeric::interval_lib; tan(boost::numeric::interval<double, policies< save_state <rounded_transc_opp<double> >, checking_strict<double> > > (2.0)); return 0; }
/usr/include/boost/numeric/interval/transc.hpp: In function ` boost::numeric::interval<T, Policies> boost::numeric::tan(const boost::numeric::interval<T, Policies>&) [with T = double, Policies = boost::numeric::interval_lib::policies<boost::numeric::interval_lib::save_state<boost::numeric::interval_lib::rounded_transc_opp<double, boost::numeric::interval_lib::rounded_arith_opp<double, boost::numeric::interval_lib::rounding_control<double> > > >, boost::numeric::interval_lib::checking_strict<double> >]': test_interval.cpp:8: instantiated from here /usr/include/boost/numeric/interval/transc.hpp:109: error: no matching function for call to `fmod(const boost::numeric::interval<double, boost::numeric::interval_lib::policies<boost::numeric::interval_lib::save_state<boost::numeric::interval_lib::rounded_transc_opp<double, boost::numeric::interval_lib::rounded_arith_opp<double, boost::numeric::interval_lib::rounding_control<double> > > >, boost::numeric::interval_lib::checking_strict<double> > >&, const boost::numeric::interval<double, boost::numeric::interval_lib::policies<boost::numeric::interval_lib::detail::save_state_unprotected<boost::numeric::interval_lib::rounded_transc_opp<double, boost::numeric::interval_lib::rounded_arith_opp<double, boost::numeric::interval_lib::rounding_control<double> > > >, boost::numeric::interval_lib::checking_strict<double> > >&)'
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost