id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 4964,Annoying assert from runtime library when calling a function from boost::numeric::interval,Torsten Hauska ,Boris Gubenko,"The following code sequence creates an assert in _control87(): boost::numeric::interval i(0.0, 0.0); boost::numeric::interval i2 = 60.0 - i; The assert dialog states the following: --------------------------- Microsoft Visual C++ Debug Library --------------------------- Debug Assertion Failed! Program: ... File: amd64\ieee.c Line: 109 Expression: (mask&~(_MCW_DN|_MCW_EM|_MCW_RC))==0 For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts. (Press Retry to debug the application) --------------------------- Abbrechen Wiederholen Ignorieren --------------------------- This happens on Windows 7 64 Bit using Vc8, Vc9 or Vc10 and creating x64 debug binaries. 32 bit builds are not affected. The problem seems to be that _control87 doesn't accept _MCW_PC or _MCW_IC as mask bits in 64 bit mode. Removing those bits from the mask let the assert vanish. I simply modified set_rounding_mode() in ""boost\numeric\interval\detail\msvc_rounding_control.hpp"": static void set_rounding_mode(const rounding_mode mode) { _control87( hard2msvc(mode), #if defined(_M_AMD64) _MCW_EM | _MCW_RC #else _MCW_EM | _MCW_RC | _MCW_PC | _MCW_IC #endif ); } Microsoft says on MSDN (when you google for _control87): ""On the x64 architecture, changing the floating point precision is not supported. If the precision control mask is used on that platform, an assertion and the invalid parameter handler is invoked, as described in Parameter Validation."" The same seems to be true for _MCW_IC. You can verify the fact with a simply command line program like: #include int _tmain(int argc, _TCHAR* argv[]) { unsigned int cur = _control87(0, 0); _control87(_MCW_EM | _PC_64 | _RC_UP | _IC_AFFINE, _MCW_EM | _MCW_RC | _MCW_PC | _MCW_IC); _control87(cur, _MCW_EM | _MCW_RC | _MCW_PC | _MCW_IC); return 0; } You will get an assert in both calls to _control87 when you compile this in debug mode for the x64 platform. Kind regards, Torsten",Bugs,closed,Boost 1.58.0,interval,Boost 1.57.0,Problem,fixed,,prabhu.swain@…