- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The code in the attached project gives bad answers when compiled in an optizmized mode. If the sub2.for source is compiled with optimization disabled it works fine. But the same construct occurs in a number of places in our code and it seems to give bad answers if optimized. I've tested this in 9.0.
The console1 project is set to build this. The sub2 file has optimization disabled so it runs correctly as sent. enable optimization for the file and it will run incorrectly.
Thanks
Dave
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why do you expect something different?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't think you looked at the code close enough. The precision is very carefully tracked the purpose of the code is to store a double precision value in 2 single precision values. Conversion are done on the delta so that when the 2 single precision values are converted back to double and added, they will equal the original dp value. This has worked fine for 20+ years on more than half a dozen compilers. The optimized code is definitely wrong. All the numbers are easily represented in DP. The deltas or 1e-7 1e-8 and 1e-9 are also easily represented in SP values. So doing the conversions using SNGL and DBLE should work correctly in the optimized version.
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One thing that I think may be important, but don't know for sure is that the values are in a common block. The same code without common blocks worked okay in some of my tests to generatethis simple sample problem.
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you say "optimized," it is reasonable to assume you set at least -QxW, but your report indicates that you may not have done so. I would agree that the non-SSE2 code with -Qfp_port isn't optimized, if you want to make that point.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
dajum wrote:
All the numbers are easily represented in DP. The deltas or 1e-7 1e-8 and 1e-9 are also easily represented in SP values.
A quibble:the numbers in question can beapproximated by IEEE single- or double-precision values. They cannot be exactly represented in either format although the error is less than 1 LSB. Using 0.0000001 as an example, the IEEE single-precision representation is slightly larger than 0.0000001 while the double-precision representation isslightly smaller, but there are no other representations which are closer to 0.0000001.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page