Opened 15 years ago

Last modified 14 years ago

#1632 new Bugs

Default Interval rounding policies incomplete

Reported by: Steven Robbins <smr@…> Owned by: No-Maintainer
Milestone: Boost 1.36.0 Component: numeric
Version: Boost 1.34.1 Severity: Problem
Keywords: Cc: 440178@…

Description

Report originates at http://bugs.debian.org/440178

The rounding policy requirements (http://boost.org/libs/numeric/interval/doc/rounding.htm) list e.g. tan_down(), but none of the implementations in rounded_arith.hpp implement it.

The result is that this code fails to compile:

#include <boost/numeric/interval.hpp>

int main( int ac, char* av[] )
{
    boost::numeric::interval<double> I(0.1, 0.2);
    I = tan(I);

    return 0;
}

Change History (3)

comment:1 by Douglas Gregor, 15 years ago

Owner: changed from Douglas Gregor to No-Maintainer

comment:2 by Steven Robbins <smr@…>, 14 years ago

This bug is still present in 1.35.0.

in reply to:  description comment:3 by Ben Galehouse <bgalehouse@…>, 14 years ago

According to the documentation at http://www.boost.org/doc/libs/1_35_0/libs/numeric/interval/doc/rounding.htm in the "transcendental function" section, the standard library routines for tan, etc, do not typically satisfy the needed rounding properties and therefore the templates which implement them are disabled by default.

I have used tan with the interval library. If you pass it a policy based on rounded_transc_std, it works fine. e.g. I have written a rounded_control specialization for the mpfr_class type from the gmpfrxx interface to mpfr. (http://math.berkeley.edu/~wilken/code/gmpfrxx/) With it I can declare the specialization

template<>
struct rounded_math<mpfr_class> 
  : save_state_nothing<rounded_transc_std<mpfr_class> >
{};    

and then code like

 j =  boost::numeric::interval<mpfr_class> (0.1,0.2);
  j = boost::numeric::tan(j);

  std::cout << "[" << j.lower() << "," << j.upper() << "]" << "\n";

compiles, executes, and gives plausible looking results. Therefore, I think this is working as designed.

Note: See TracTickets for help on using tickets.