Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在输出文件中使用科学格式,我得到:0.245E+02 而不是 2.45E+01。
如何在 Fortran 中以后期格式输出?
x = 2.45 write(*,130) 'x=', x 130 format (A,E8.2)
更新: 根据@Bálint Aradi 的回答,我应该设置x = 24.5才能得到2.45E+01.
x = 24.5
2.45E+01
您应该使用“科学指数”( ES) 格式:
ES
x = 2.45 write(*, "(A,ES8.2)") "X=", x
尝试 P 编辑格式。
write(*,"(A,1PE8.2)") 'X=',x