Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29278 Discussions

Floatin Point difference between IF9 and IF11

David_Place
Beginner
1,093 Views

We currently in the process to upgrade our compiler from IF9 to IF11.We identified an issue related to the Floating Point model used in IF11 compared to IF9 which leads to different results due to rounding.

The difference originate from the order the operands are promoted to double precision. In IF9, all terms of an expression are promoted to double if the expression involves a double. However in IF11, only the terms that are directly involved with a double are promoted (eg. In the following expression (R+R)*D, where R is a float and D a double, the operation + is performed in single precision with IF11 and in double precision with IF9).

Is there a switch I could use in IF11 that would force the compiler to use the same floating point model as in IF9 when optimisation is disbaled?

0 Kudos
3 Replies
Xiaoping_D_Intel
Employee
1,093 Views
In IFORT 9 when optimization is disabled by /Od the default fp-model is fltconsistency but IFORT 11 is not. Please add /fltconsistency to the command line and have a try.


0 Kudos
TimP
Honored Contributor III
1,093 Views
In this specific case, it doesn't matter whether (R+R) is evaluated in single or double precision, unless the operation overflows. In ifort 9, clearly, /Od gives x87 code, regardless of any /Qx switches, while in ifort 11 32-bit, you should set /arch: ia32 if you want x87 code. Among other things, x87 code implicitly promotes expressions to double precision, unless you set 24-bit precision mode explicitly.
If all you are looking for is promotion to double, regardless of your instruction set choice, you should write it in:
(in pre-f90 style)
(dble+R)
Are you referring to the fact that 32-bit ifort default changed from x87 (/arch:ia32 for ifort 11) to /arch:SSE2 in ifort 11 (ifort 9 option /QxW) ?
0 Kudos
David_Place
Beginner
1,093 Views
Thanks Xiaoping, the /fltconsistency worked beautifully.

0 Kudos
Reply