知識社群Login
fortran 的 real 精確度
by 高顯忠, 2010-12-08 07:23, Views(2582)
!dec$if(.false.)

   11.00000       10.00000
Fortran Pause - Enter command<CR> or <CR> to continue.

    16777216.000   16777216.000
Fortran Pause - Enter command<CR> or <CR> to continue.


!dec$endif
! ---------------------------------------------------------

program VF0904
implicit none

real a, b
a= 10.0
b= a + 1.0

! b= 11, > 10, b > a
print *, b, a
pause

do while (b .GT. a)
  a= a + 1.0
  b= b + 1.0
end do

! not for (b > a), --> b <= a
write(*, '(1x, 2F15.3)')b, a
pause
end program VF0904