Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Re: Rounding mode (as specified in FPU.h)

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Re: Rounding mode (as specified in FPU.h)


Chronological Thread 
  • From: Marc Glisse <>
  • To:
  • Subject: Re: [cgal-discuss] Re: Rounding mode (as specified in FPU.h)
  • Date: Thu, 28 Feb 2013 21:51:19 +0100 (CET)

On Thu, 28 Feb 2013, marcosscriven wrote:

The thing is we *can* call into C/C++ code, it's just we have to implement
it ourselves (so that we can compile it into Javascript too).

Well, no, I meant call into *natively compiled* C code ;-)

The only implementations I can find rely on the CPU to do the right rounding, I've not found a code implementation of one.

Implementing fesetround can hardly be anything but a use of the CPU-specific set-the-rounding-mode instruction, so if all you can program in is core C there is no way around that.

I.e, change the current mode of rounding in the processor itself,
temporarily, just for certain functions?

Yes.

Is it right to say therefore it's not possible to choose just one rounding
mode, and use that the whole time?

If you use only static filters and no intervals, you might get away with a constant round-to-nearest mode. If you use intervals (and not all operations on them, no sqrt in particular) but no static filters, you might get away with a constant round-upwards mode. If you were extremely motivated, you could recompute the bounds in the static filters to make them loose enough to work with any rounding.

Is it also correct to say that the reason there would be infinite loops is
that a numerical method relying on a particular rounding mode might never
meet its convergence condition?

The reason is that predicates would give wrong answers. And as explained in length on the CGAL website, this may yield combinatorially impossible configurations, obviously unplanned for in the algorithms, and thus you might for instance walk in circles in a triangulation trying to locate a point.

If so, is there any way in CGAL to specify an 'acceptable' accuracy?

No. The exact computation paradigm is not about getting "close enough" results, it is about remaining consistant to ensure we get a result at all. Proper rounding is essential in determining if the approximate computations were acceptably accurate or if we need to compute things exactly (with gmp).

Thanks again for your help - appreciate this is an unusual situation.

Best solution might be to introduce fe[sg]etround functions in your favorite javascript engine.

--
Marc Glisse



Archive powered by MHonArc 2.6.18.

Top of Page