Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] use of Interval_nt in Sqrt_extension
- Date: Thu, 26 Jul 2012 09:57:00 +0200
I see.
I think it's a bug, because the protector should be placed just before const CGAL::Interval_nt<false>& x_int=...
Can you check and tell me if it's working then.
Sebastien.
On 07/26/2012 09:35 AM, Marc Mörig wrote:
On 07/26/2012 09:24 AM, Sebastien Loriot (GeometryFactory) wrote:
On 07/26/2012 09:09 AM, Marc Mörig wrote:
Dear CGAL maintainers,Are you sure the problems is coming from that part? The previous
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.
rounding mode mode is restored when the protector is deleted.
Sebastien.
I am pretty sure. a0_ is of a custom number type I wrote myself. Hence
the directed rounding mode is in effect when my code is called. The
problem goes away if I move the Protector creation three lines
downwards. This is ok, since no floating-point operations are performed
in the interval assignment anyways.
Marc
- [cgal-discuss] use of Interval_nt in Sqrt_extension, Marc Mörig, 07/26/2012
- Re: [cgal-discuss] use of Interval_nt in Sqrt_extension, Sebastien Loriot (GeometryFactory), 07/26/2012
- Re: [cgal-discuss] use of Interval_nt in Sqrt_extension, Marc Mörig, 07/26/2012
- Re: [cgal-discuss] use of Interval_nt in Sqrt_extension, Sebastien Loriot (GeometryFactory), 07/26/2012
- Re: [cgal-discuss] use of Interval_nt in Sqrt_extension, Marc Mörig, 07/26/2012
- Re: [cgal-discuss] use of Interval_nt in Sqrt_extension, Sebastien Loriot (GeometryFactory), 07/26/2012
- Re: [cgal-discuss] use of Interval_nt in Sqrt_extension, Marc Mörig, 07/26/2012
- Re: [cgal-discuss] use of Interval_nt in Sqrt_extension, Sebastien Loriot (GeometryFactory), 07/26/2012
Archive powered by MHonArc 2.6.18.