- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have written a code to solve four simultaneos NL equations using a Newton-Raphson method. The code compiles and runs with no errors in Debug and Release. However, the output results from the release version and the debug version are different for the same input file. I do not understand why this should be. Any ideas?
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The release version is optimized, and this can change floating point results slightly due to different order of instructions, use of extended precision registers, etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is this still true if optimization is disabled under the project properties?
If there is code optimization that is still occurring, which mode, debug or release, would produce a more accurate solution? Or is neither more accurate than the other. Is there a way to move the two methods to a common solution?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If optimization is disabled, then it is disabled. But there are other project options, such as array bounds checking or generation of debug symbol information, that could cause differences in an incorrect program. You can certainly experiment with making the two configurations more alike until you find what makes the difference.
In general, the optimized/release version is more accurate. There are compiler options to enhance "floating point consistency" at the expense of performance and accuracy.
In general, the optimized/release version is more accurate. There are compiler options to enhance "floating point consistency" at the expense of performance and accuracy.

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