Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

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


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] use of Interval_nt in Sqrt_extension
  • Date: Thu, 26 Jul 2012 09:24:54 +0200

On 07/26/2012 09:09 AM, Marc Mörig wrote:
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.

Are you sure the problems is coming from that part? The previous
rounding mode mode is restored when the protector is deleted.

Sebastien.


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

Regards,
Marc Mörig





Archive powered by MHonArc 2.6.18.

Top of Page