Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] use of Interval_nt in Sqrt_extension

Subject: CGAL users discussion list

List archive

[cgal-discuss] use of Interval_nt in Sqrt_extension


Chronological Thread 
  • From: Marc Mörig <>
  • To:
  • Subject: [cgal-discuss] use of Interval_nt in Sqrt_extension
  • Date: Thu, 26 Jul 2012 09:09:29 +0200

Dear CGAL maintainers,

in the file Sqrt_extension_type.h, there is the following code:

std::pair<double, double> compute_to_interval() const
{
if (! is_extended_)
return CGAL_NTS to_interval(a0_);
CGAL::Interval_nt<false>::Protector p;
const CGAL::Interval_nt<false>& a0_int = CGAL_NTS to_interval(a0_);
const CGAL::Interval_nt<false>& a1_int = CGAL_NTS to_interval(a1_);
const CGAL::Interval_nt<false>& root_int = CGAL_NTS to_interval(root_);
const CGAL::Interval_nt<false>& x_int =
a0_int + (a1_int * CGAL::sqrt(root_int));

std::pair<double, double> res(x_int.inf(), x_int.sup());
this->update_cached_value(res);
return res;
}


The Protector p sets a directed rounding mode for floating point arithmetic, which is propagated to other code inside, e.g. to_interval(a0_). In my case, this breaks code which assumes the default rounding mode.

Should I consider this a bug or a feature? It is easily fixable in CGAL though.

Regards,
Marc Mörig

--
Marc Mörig Email:

Institut für Simulation und Graphik Phone: +49 391 67-52858
Otto-von-Guericke Universität Magdeburg Office: G29-227



Archive powered by MHonArc 2.6.18.

Top of Page