py-fortranformat icon indicating copy to clipboard operation
py-fortranformat copied to clipboard

FortranRecordWriter('(E10.0)').write([10.0]) => '**********'

Open hyperkang opened this issue 3 years ago • 3 comments

>>> FortranRecordWriter('(E10.0)').write([10])
'**********'

>>> FortranRecordWriter('(E10.0)').write([10.0])
'**********'

>>> FortranRecordWriter('(E10.1)').write([10])
'   0.1E+02'

hyperkang avatar Feb 10 '22 14:02 hyperkang

Hi, this is as expected - Gfortran actually crashes on this input, Intel Fortran outputs the above - try running the following against your compiler to get some examples ...

      PROGRAM E_EDIT

      IMPLICIT NONE

100   FORMAT ('[', E10.0, ']')
      
      WRITE (*, 100) 0.0
      WRITE (*, 100) 0.01
      WRITE (*, 100) 0.1
      WRITE (*, 100) 1
      WRITE (*, 100) 1.1
      WRITE (*, 100) 10.0
      WRITE (*, 100) 1000.0

      STOP
      END

brendanarnold avatar Feb 10 '22 20:02 brendanarnold

@hyperkang Have you been able to run this to check the behaviour? If so and it matches can we close?

brendanarnold avatar Feb 17 '22 16:02 brendanarnold

Intel is pretty explicit:

/app/example.f90(5): remark #8577: The scale factor (k) and number of fractional digits (d) do not have the allowed combination of either -d < k <= 0 or 0 < k < d+2. Expect asterisks as output.
100   FORMAT ('[', E10.0, ']')
-----------------------^

ZedThree avatar Feb 06 '23 10:02 ZedThree