[Clp] patch for Visual C++ floating-point model problem
Michael Hennebry
hennebry at web.cs.ndsu.nodak.edu
Sun Aug 10 12:01:42 EDT 2008
On Sun, 10 Aug 2008, Arno Schödl wrote:
> With my floating-point model problem, I should have probably asked first which floating point model Clp/COIN assumes. This is the GCC compiler thread referring to the same problem:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323
>
> They apparently decided that GCC by default won't guarantee any rounding, similar to MSVC's /fp:fast. With the GCC -ffloat_store option, behavior is similar to MSVC /fp:precise, forcing rounding to 64 bit on assignments. I did not find this option in the COIN-Clp makefiles, and I do not recommend it because it hurts performance. If there is no other provision made that I overlooked, it seems to me that the current Clp code is incorrect, and something along the lines of my patch would be necessary.
IIRC neither C89 nor C++ guarantee much about floating point.
The only guarantees are the definitions of the values in float.h .
In particluar, x+y is not guaranteed to give the same value twice
even if x and y are unchanged, even if the value is exactly representable.
In the x86's, I think that the problem could be worked
around by either by converting all the doubles to long
doubles or by using a compiler in which double is 80 bits.
C99 might be different.
--
Michael hennebry at web.cs.ndsu.NoDak.edu
"Those parts of the system that you can hit with a hammer (not advised)
are called Hardware; those program instructions that you can only
curse at are called Software."
More information about the Clp
mailing list