Floating Point Optimization Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using Microsoft Visual C++ .NET 69462-270-0000007-18921

When I build the following code in Visual C++ .NET for release, there is a serious optimization error that corrupts the resulting value

double m1 = 1.05

m1 = 1.0/m1

In release image, m1 is much smaller than 1e-9
In debug image, m1 is correct

Has anybody else seen this problem
 
Just noticed your posting when doing a google search.

Which version of the C++ compiler are you using?
To determine this,
- open a command-line console window
- type vsvars32 (this will put cl.exe in your path)
- type cl

I am not able to reproduce your results using version 7.1
If you are using version 7.0, then try the /Op switch

Hope this is helpful
Eric Fleegal
<a href="http://blogs.msdn.com/ericflee">http://blogs.msdn.com/ericflee</a>
 
Back
Top