0

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.

  • All real variables and constants should be promoted by the flag. I have no time to study the XLF manual, (you should do that!), but normal same compilers do that. – Vladimir F Героям слава Aug 14 '15 at 15:32
  • 1
    If I was concerned about this issue I'd probably rewrite the literal as `1.0d6` (or `1.0_real64` or some equivalent) and see what impact it has. Of course, you'll probably tell me the deviations only begin after 100,000 cpu-hours of computation .... – High Performance Mark Aug 14 '15 at 15:35
  • 2
    To add to the other comments, `1e6` is a literal real constant of default kind. – francescalus Aug 14 '15 at 15:47
  • for this particular example the `1.0E6` is exactly represented regardless of its precision. Of course you say "similar to this" so I guess you have some other cases where there is a difference. – agentp Aug 14 '15 at 20:00
  • Hi All,thanks for Vladimir reminding me to RTM. – NCAS MarkRichardson Aug 17 '15 at 08:53

1 Answers1

0
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.