Skip to content

Commit 97d75e1

Browse files
committed
Add sign suppression for predictable output
1 parent d9abc9d commit 97d75e1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/json_module.F90

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,8 +1119,8 @@ end subroutine array_callback_func
11191119
!6 = sign + leading 0 + decimal + 'E' + exponent sign + 1 extra
11201120
integer(IK),parameter :: max_numeric_str_len = real_precision + real_exponent_digits + 6
11211121
! real format set by library initialization
1122-
character(kind=CDK,len=*),parameter :: int_fmt = '(I0)' !minimum width format for integers
1123-
character(kind=CK, len=*),parameter :: star = '*' !for invalid numbers
1122+
character(kind=CDK,len=*),parameter :: int_fmt = '(ss,I0)' !minimum width format for integers
1123+
character(kind=CK, len=*),parameter :: star = '*' !for invalid numbers
11241124

11251125
!real string printing:
11261126
character(kind=CDK,len=:),allocatable :: real_fmt !the format string to use for real numbers
@@ -2153,13 +2153,13 @@ subroutine json_initialize(verbose,compact_reals)
21532153
! set the default output/input format for reals:
21542154
! [this only needs to be done once, since it can't change]
21552155
if (.not. allocated(real_fmt)) then
2156-
write(w,'(I0)',iostat=istat) max_numeric_str_len
2157-
if (istat==0) write(d,'(I0)',iostat=istat) real_precision
2158-
if (istat==0) write(e,'(I0)',iostat=istat) real_exponent_digits
2156+
write(w,'(ss,I0)',iostat=istat) max_numeric_str_len
2157+
if (istat==0) write(d,'(ss,I0)',iostat=istat) real_precision
2158+
if (istat==0) write(e,'(ss,I0)',iostat=istat) real_exponent_digits
21592159
if (istat==0) then
2160-
real_fmt = '(E' // trim(w) // '.' // trim(d) // 'E' // trim(e) // ')'
2160+
real_fmt = '(ss,E' // trim(w) // '.' // trim(d) // 'E' // trim(e) // ')'
21612161
else
2162-
real_fmt = '(E30.16E3)' !just use this one (should never happen)
2162+
real_fmt = '(ss,E30.16E3)' !just use this one (should never happen)
21632163
end if
21642164
end if
21652165

0 commit comments

Comments
 (0)