Closed kurtvdb closed 5 years ago
Looks like a reasonable fix, however when trying it with MSVC 2017 and Windows 10 I get:
.\gecode/float.hh(138): error C3203: 'rounded_arith_std': unspecialized class template can't be used as a template argument for template parameter 'Rounding', expected a real type
Do you have a access to MSVC 2017 and could try?
Thanks and cheers Christian
I tried to build gecode 6.1.1 with the same change and it builds OK. compiler version: Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26726 for x64
I attached my float.hh file. float.hh.txt
Thanks! In develop.
Describe the bug
I noticed that one of my gecode models (using float variables) had a different result when running it twice in succession. the first time the model finds a result, the second time it doesn't. a lot of searching showed that after the first gecode search, the rounding control for floating point numbers was changed. (the _controlfp() or _control87() function can change this flag). I noticed in the gecode sourcecode (some parts are really boost) that in most cases where the rounding control is changed, it is reset to the original value again. (using the gecode_boost::numeric::interval_lib::save_state wrapper class). in at least one case, this wrapper isn't used (float.hh): typedef gecode_boost::numeric::interval_lib::rounded_arith_stdRoundingBase;
when I replaced the above line with this one: typedef gecode_boost::numeric::interval_lib::save_state< gecode_boost::numeric::interval_lib::rounded_arith_std > RoundingBase;
my problem went away.
I don't know if this change fixes all cases, but it fixed my problem.
To Reproduce
I can't provide a gecode model that shows the problem. the model I have the problem with is very complex and I didn't succeed in making it simple enough to include here.
check the floating point control word before and after running a search on a model containing floating point variables. the result will be different. unsigned int controlfp = _controlfp (0, 0);
Gecode and Platform Configuration
gecode 6.1.1 (and 5.1.0) windows server 2016 visual studio 2017