[Clp] patch for Visual C++ floating-point model problem
Arno Schödl
aschoedl at think-cell.com
Sun Aug 10 12:09:57 EDT 2008
MSVC does not support long doubles:
http://msdn.microsoft.com/en-us/library/d0we956d(VS.80).aspx
Arno
-----Original Message-----
From: Michael Hennebry [mailto:hennebry at web.cs.ndsu.nodak.edu]
Sent: Sunday, August 10, 2008 6:02 PM
To: Arno Schödl
Cc: clp at list.coin-or.org
Subject: Re: [Clp] patch for Visual C++ floating-point model problem
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."
--
Dr. Arno Schoedl · aschoedl at think-cell.com
Technical Director
think-cell Software GmbH · Invalidenstr. 34 · 10115 Berlin, Germany
http://www.think-cell.com · phone +49-30-666473-10 · fax +49-30-666473-19
Geschäftsführer: Dr. Markus Hannebauer, Dr. Arno Schoedl · Amtsgericht Charlottenburg, HRB 85229
More information about the Clp
mailing list