Subject: CGAL users discussion list
List archive
Re: [cgal-discuss] Modular Arithmetic: Residue_type.h throwing Assertion Handling error.
Chronological Thread
- From: Michael Hemmer <>
- To:
- Subject: Re: [cgal-discuss] Modular Arithmetic: Residue_type.h throwing Assertion Handling error.
- Date: Sat, 27 Mar 2010 16:38:05 +0300
From the manual:
Please note that the implementation of class /CGAL::Residue/ requires a mantissa precision according to the IEEE Standard for Floating-Point Arithmetic (IEEE 754). However, on some processors the traditional FPU uses an extended precision. Hence, it is indispensable that the proper mantissa length is enforced before performing any arithmetic operations. Moreover, it is required that numbers are rounded to the next nearest value. This can be ensured using /CGAL::Protect_FPU_rounding/ with /CGAL_FE_TONEAREST/, which also enforces the required precision as a side effect.
Setting this within each and every arithmetic operations would waste too much time.
And the lines in the Example:
// Enforce IEEE double precision and rounding mode to nearest // before useing modular arithmetic CGAL::Protect_FPU_rounding<true> pfr(CGAL_FE_TONEAREST)
Michael Hemmer
Sanket Agarwal wrote:
HI Guys,
I am trying to use the Modular Arithmetic functionalities of the CGAL package. Right now I am trying to familiarise myself with the code structure. I am trying to compile/run the following code snippet:
CGAL::Residue res(10); // Initialising the object res of residue class with the int constructor.
I am being bumped up with the following error:
-----------------------------------------------------------------------------------------------------
terminate called after throwing an instance of 'CGAL::Assertion_exception'
what(): CGAL ERROR: assertion violation!
Expr: FPU_get_cw() == CGAL_FE_TONEAREST
File: /usr/local/include/CGAL/Modular_arithmetic/Residue_type.h
Line: 110
Aborted
-----------------------------------------------------------------------------------------------------
Residue_type.h:
-----------------------------------------------------------------------------------------------------
106. static inline
107. double RES_round (double a){
108. // call CGAL::Protect_FPU_rounding<true> pfr(CGAL_FE_TONEAREST)
109. // before using modular arithmetic
110. CGAL_assertion(FPU_get_cw() == CGAL_FE_TONEAREST);
111. return ( (a + CST_CUT) - CST_CUT); }
-----------------------------------------------------------------------------------------------------
Any pointers as to how I can correct this error ?
- [cgal-discuss] Modular Arithmetic: Residue_type.h throwing Assertion Handling error., Sanket Agarwal, 03/27/2010
- Re: [cgal-discuss] Modular Arithmetic: Residue_type.h throwing Assertion Handling error., Michael Hemmer, 03/27/2010
Archive powered by MHonArc 2.6.16.