Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Inconsistent floating point rounding mode after calls to CGAL with Visual Studio 2005, SP1 (only in 64 bits)

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Inconsistent floating point rounding mode after calls to CGAL with Visual Studio 2005, SP1 (only in 64 bits)


Chronological Thread 
  • From: Andreas Fabri <>
  • To:
  • Subject: Re: [cgal-discuss] Inconsistent floating point rounding mode after calls to CGAL with Visual Studio 2005, SP1 (only in 64 bits)
  • Date: Mon, 19 Feb 2007 12:22:00 +0100


Hello,

Thank you for signalling this problem.
I confirm this behaviour for VC++2005/XP64/AMD Turion.
I noticed that you already signalled it to Microsoft
and they told you that they won't fix it.
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=257605



A construction as follows might fix it;

bool catched = false;
try {

}
catch() {
catched = true;
}
if(catched){
reset the rounding
}

best regards,

andreas





wrote:
Hello,

We found a very disturbing bug in Visual Studio 2005. We have the Service
Pack 1 installed and are compiling in 64 bits (in 32 bits mode, everything is
fine). We have CGAL version 3.2. We run on Windows XP(SP2) on dual Xeon
workstations.

We found the bug in our 64 bits regression tests when some tests would pass
if run alone but would fail if some other tests (using CGAL) were run before.

The problem is that the rounding mode that is changed by interval_nt is not
reset to its previous state (in a catch) even though good exceptions and RAII
technics are used. Here is a small program that reproduces the bug mechanism
without using interval_nt.

#include <float.h>
#include <stdio.h>
void main()
{
try
{
_controlfp( _RC_UP, _MCW_RC );
throw 1;
}
catch ( ... )
{
// Sets the rounding mode to 0 and show that it's realy the case.
_controlfp( 0, _MCW_RC );
unsigned int cw = _controlfp( 0, 0 ) & _MCW_RC;
printf( "this 1st value should be 0: %d\n", cw );
}

// After the catch, this value will not be 0 in x64
unsigned int cw = _controlfp( 0, 0 ) & _MCW_RC;
printf( "this 2nd value should be 0: %d\n", cw );
}

Are you aware of this strange behavior? Can you verify if it's happening on
other compilers? We are worried that it could invalidate the interval
arithmetic filter strategy used in CGAL in 64 bits...

Thank you,

Bruno Martin




Archive powered by MHonArc 2.6.16.

Top of Page