How to pad Fortran floating point output with leading zeros?

前端 未结 5 1093
执念已碎
执念已碎 2020-12-10 15:57

I have some floating point numbers that I need to output from a Fortran program. Let\'s say the maximum number could be 999.9999 and they are all non-negative. I need zero

5条回答
  •  时光说笑
    2020-12-10 16:21

    This works for me

    real :: areal
    

    then

    write(*,'(i3.3,f0.6)') int(areal),areal-int(areal)
    

提交回复
热议问题