View Full Version : Floating point calculations and results.
R. T. (Fortran Man)
09-03-2003, 05:47 PM
Why do the results of my floating point (REAL) number calculations sometimes differ from those on non-Intel machines? Why do mt results differ when I compile with different LF90 optimization levels?
Lahey Support
09-03-2003, 05:50 PM
Intel's math coprocessor uses 80 bit registers for floating point calculations. This differs from the register size of some other coprocessors. To help guarantee the consistency of your REAL and COMPLEX calculations, use the "-AP" switch (LF90) or the "/7" switch (EM/32). These switches will force all non-INTEGER operands to be reloaded from memory, effectively truncating them to 32-bit (REAL*4) or 64-bit (REAL*8) representations.
In LF90, changing (increasing) the optimization level gives the code generator more liberties to rearrange the order of arithmetic expression evaluation (it can also eliminate unnecessary evaluations.) This will affect which intermediate results must be stored in memory (64 bits) and which can be used directly from one of the floating point registers. Using -AP should elimimate the differences from these causes.
For more detailed information see The Perils of Floating Point at http://www.lahey.com/float.htm
vBulletin® v3.6.8, Copyright ©2000-2012, Jelsoft Enterprises Ltd.