program test
implicit none
integer :: Npop,tmin
INTEGER(KIND=2) ::Run_time
integer( kind = 8 ) :: Gene
CALL Get_Best (8,10,1,Gene)
write(*,*)'Gene:',Gene
end program test
! ******************** Get_Best *****************
subroutine Get_Best (tmin,Npop,Run_time,Gene)
implicit none
integer,intent(in) :: tmin,Npop
integer :: Run_time
integer(KIND=8) :: Gene
integer(KIND=8),dimension(Npop) :: GeneZ
integer :: i,l
CHARACTER(LEN = 2) :: cRun_time
character(LEN=100) :: Nome,annotation
CHARACTER(*), PARAMETER :: fileplace = "D:/simulation/"
write(cRun_time,'(I2)') Run_time
Nome = TRIM(ADJUSTL(cRun_time))//'namlist_in.txt'
OPEN(1,file = fileplace//Nome,status='old',FORM='FORMATTED')
read(1,'(A)') annotation
read(1,'(6X,I40)') (GeneZ(i),i=1,Npop)
close(1)
write(*,*)'GeneZ:',GeneZ
Gene=GeneZ(tmin)
end subroutine Get_Best
报错.png (124.91 KB, 下载次数: 158)
488 Bytes, 下载次数: 2
Transpose 发表于 2022-9-28 21:00
无法解决,integer(8)最大是9223372036854775807,总共19位,没法读取这么大的数。
fcode 发表于 2022-9-29 08:48
有些看起来像数字的东西,如果不会参与计算的话,就用字符串来存储和读写吧。
比如身份证号码,你几乎不需 ...
li913 发表于 2022-9-28 21:36
首先从需求分析,你是否需要这么多位?
fortran做不到,可否用变通的方法,比如用多个数来存储,或者用字符 ...
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |