changed format es24.15 -> es24.15e3 in xml writer.

in gfortran 12.2.0 the code:

program pippo
      integer, parameter :: dp = selected_real_kind(16)
      real(dp) :: t(3)
      real(dp) :: m(3,3)

      t=(/ 1.445e-108_dp/23.0_dp, 73.3_dp, 1.2e-87_dp /)
      write( *, '(1p3es24.15)' ) t
      write( *, '(2p3es24.15e3)' ) t
      write( *, '(1pes24.15)') t(1)
      write( *, '(1pes24.15e3)') t(1)

      m=0.0_dp
      m(2,2)=3.456e-200_dp
      m(3,1)=1.234e300_dp
      write(*, '(1p3es24.15)') m
      write(*, '(1p3es24.15e3)') m

end program pippo

produces the output
   6.282608695652174-110   7.330000000000000E+01   1.200000000000000E-87
  6.282608695652174E-110  7.330000000000000E+001  1.200000000000000E-087
   6.282608695652174-110
  6.282608695652174E-110
   0.000000000000000E+00   0.000000000000000E+00   1.234000000000000+300
   0.000000000000000E+00   3.456000000000000-200   0.000000000000000E+00
   0.000000000000000E+00   0.000000000000000E+00   0.000000000000000E+00
  0.000000000000000E+000  0.000000000000000E+000  1.234000000000000E+300
  0.000000000000000E+000  3.456000000000000E-200  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000

please note that the 'E' is missing for the tinier double precision floating point numbers
this was causing error in the parsing of the XML
This commit is contained in:
Riccardo Bertossa 2023-05-16 09:51:07 +02:00
parent 448a24e191
commit b2115aa54d
1 changed files with 4 additions and 4 deletions

View File

@ -325,7 +325,7 @@ CONTAINS
if ( ierr /= 0 ) print *, 'xml_addcharacter: ierr = ', ierr
opentag = ''
end if
write( cfield, '(1pes24.15)' ) field
write( cfield, '(1pes24.15e3)' ) field
write( xf%unit, '(A)', advance='no' ) trim(adjustl(cfield))
end if
!
@ -352,10 +352,10 @@ CONTAINS
newline = .false.
end if
if ( sameline) then
write( cfield, '(1p3es24.15)' ) field
write( cfield, '(1p3es24.15e3)' ) field
write( xf%unit, '(A)', advance='no' ) trim(adjustl(cfield))
else
write( xf%unit, '(1p3es24.15)' ) field
write( xf%unit, '(1p3es24.15e3)' ) field
endif
end if
!
@ -378,7 +378,7 @@ CONTAINS
if ( ierr /= 0 ) print *, 'xml_addcharacter: ierr = ', ierr
opentag = ''
end if
write( xf%unit, '(1p3es24.15)' ) field
write( xf%unit, '(1p3es24.15e3)' ) field
end if
!
end subroutine xml_addcharacters_rm