ES and EN Format Specifiers

Questions on using the PGI Compilers and Tools
Post Reply
prop_design
Posts: 14
Joined: Nov 06 2019

ES and EN Format Specifiers

Post by prop_design » Tue Nov 26, 2019 5:42 am

I think I found a bug in the ES and EN format specifiers. If you use these with a number like 1e-20 they work out ok. But if you try 1e-200 the E drops off. here are some examples:

INPUT SET TO = 9.9999999999999995E-021 (OUTPUT WITH DEFAULT FORMATTING)
INPUT SET TO = 9.9999999999999995E-21 (OUTPUT WITH ES25.16 FORMATTING)

INPUT SET TO = 9.9999999999999998E-201 (OUTPUT WITH DEFAULT FORMATTING)
INPUT SET TO = 9.9999999999999998-201 (OUTPUT WITH ES25.16 FORMATTING)

I also observed the same thing with EN25.16. I also tried forcing the with with ES25.16E4. But it seems to ignore anything I input for the e aspect of the format specifier. So if I try ES25.16E3 it is the same as anything else you enter in for e.

This is with 19.10 community edition pgfortran

mkcolg
Posts: 8137
Joined: Jun 30 2004

Re: ES and EN Format Specifiers

Post by mkcolg » Tue Nov 26, 2019 9:12 am

Hi prop_design,

Without the trailing "E3", the think formatting is working as expected, at least all compilers I test produce the same output. However, it does appear to be an issue when using "E3" since both Intel and GNU then include the "E" in the output. I've added a problem report, TPR #27875, and sent it to our engineers for review.

Code: Select all

% cat teste.f90
program foo
  real(8):: var1, var2
  var1 = 9.9999999999999998E-021_8
  print '(ES25.16)', var1
  print '(EN25.16)', var1
  var2 = 9.9999999999999998E-201_8
  print '(ES25.16)', var2
  print '(ES25.16E3)', var2
  print '(EN25.16)', var2
  print '(EN25.16E3)', var2
end program foo
% pgfortran teste.f90 -o teste.out ; teste.out
   9.9999999999999995E-21
   9.9999999999999995E-21
   9.9999999999999998-201
   9.9999999999999998-201
   9.9999999999999998-201
   9.9999999999999998-201
% gfortran teste.f90 -o teste.out ; teste.out
   9.9999999999999995E-21
   9.9999999999999994E-21
   9.9999999999999998-201
  9.9999999999999998E-201
   9.9999999999999998-201
  9.9999999999999998E-201
-Mat

Post Reply