did not work for values <0
This commit is contained in:
parent
42f8b0a063
commit
06e7156351
12
src/IO.f90
12
src/IO.f90
|
@ -1363,12 +1363,16 @@ function IO_continuousIntValues(fileUnit,maxN,lookupName,lookupMap,lookupMaxN)
|
||||||
pure function IO_intOut(intToPrint)
|
pure function IO_intOut(intToPrint)
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
character(len=19) :: N_Digits ! maximum digits for 64 bit integer
|
|
||||||
character(len=40) :: IO_intOut
|
|
||||||
integer(pInt), intent(in) :: intToPrint
|
integer(pInt), intent(in) :: intToPrint
|
||||||
|
character(len=41) :: IO_intOut
|
||||||
|
integer(pInt) :: N_digits
|
||||||
|
character(len=19) :: width ! maximum digits for 64 bit integer
|
||||||
|
character(len=20) :: min_width ! longer for negative values
|
||||||
|
|
||||||
write(N_Digits, '(I19.19)') 1_pInt + int(log10(real(intToPrint)),pInt)
|
N_digits = 1_pInt + int(log10(real(max(abs(intToPrint),1_pInt))),pInt)
|
||||||
IO_intOut = 'I'//trim(N_Digits)//'.'//trim(N_Digits)
|
write(width, '(I19.19)') N_digits
|
||||||
|
write(min_width, '(I20.20)') N_digits + merge(1_pInt,0_pInt,intToPrint < 0_pInt)
|
||||||
|
IO_intOut = 'I'//trim(min_width)//'.'//trim(width)
|
||||||
|
|
||||||
end function IO_intOut
|
end function IO_intOut
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue