- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Under what conditions, if any, will (current versions of) ifort assume associativity of arithmatic when working with floating point variables, and optimize away corrections such as those found in the Kahan summation algorithm: ( http://en.wikipedia.org/wiki/Compensated_summation )
i.e. Does the compiler assume associativity of arithmatic by default? When -O3 is passed? Is there a way to turn it off, if it's on?
Thanks,
Zaak
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The default will break Kahan summation except at -O0. I would suggest setting "-assume protect_parens" so you will not require O0. -fp-model source|precise also ought to work.
If the compiler ignored parentheses consistently (but in violation of the standard) the Kahan summation would collapse into an ordinary sum with no Kahan corrections, but with correct results at lower accuracy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Tim,
Good to know.

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