fortrandouble-precision

Mixed precision assignment


I am working with a large Fortran code that uses XLF compiler for Power7 It uses these flags to set the precision to 64bit: -qrealsize=8 -qintsize=8

However a recently imported piece of code has lines similar to this:

real :: var1d(nvol)
real :: var3d(ni,nj,nk)

var1d = var3d*1.0e6

I wonder how XLF is dealing with the literal 1e6? Main concern is; this is where a reference version and a modified version deviate. The 9th and 10th significant figures are different for var1d.

Nastily this grows with iterations.


Solution

  • Data Object       REALSIZE(4) in Effect       REALSIZE(8) in Effect
    -------------------------------------------------------------------
    1.2               REAL(4)                      REAL(8)
    1.2e0             REAL(4)                      REAL(8)
    1.2d0             REAL(8)                      REAL(16)
    1.2q0             REAL(16)                     REAL(16)
    
    REAL              REAL(4)                      REAL(8)
    DOUBLE PRECISION  REAL(8)                      REAL(16)
    COMPLEX           COMPLEX(4)                   COMPLEX(8)
    DOUBLE COMPLEX    COMPLEX(8)                   COMPLEX(16)
    

    As stated in the on-line XLF manual. Thanks for all the useful suggestions. SO I will have to confirm this is not the source of discrepancy.