做定步长积分计算的时候确定积分步数,我发现显示数组越界的现象Subscript #2 of the array VV has value 50000 which is greater than the upper bound of 49999,检查之后发现是积分步数直接50/0.001=49999导致越界,,但将Ts=50改成40结果就等于40000,请大神指点一下这种问题是怎么引起的?该怎么避免?Program test_IMSL
[Fortran] 纯文本查看 复制代码
implicit none
real,parameter :: dt=1e-3,Ts=50
integer,parameter :: nj=floor(Ts/dt)
write(*,*) nj
pause
end program |