[Clp] patch for Visual C++ floating-point model problem

Arno Schödl aschoedl at think-cell.com
Mon Aug 11 02:58:56 EDT 2008


> IIRC there is a bit in the x86 processors that when flipped will
> effectively lop 16 bits off the floating point registers.
> I suspect that flipping that bit would involve writing some assembler.
> That should solve the problem so long as you don't invoke any library
> functions that relay on 80-bit floating point.
> IIRC printf is one of them.

.NET/CLR does not let you change the floating-point environment at all, but still suffers from the x87 problem:

ECMA-335 http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-335.pdf
Partition I Section 12.1.3

Calling .NET actually resets the control word in some cases:

http://forums.msdn.microsoft.com/en-US/clr/thread/e45fa265-05d1-4ab4-bd4f-b6f9164ca1ab/

In native code, when programming a DLL, every entry point must set the control word properly and set it back on exit, in case the caller relies on it. Overall, I'd prefer leaving the control word alone.

Arno

--
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