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

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

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


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

program VF0904
implicit none

real*8 a, b
a= 10.0D0
b= a + 1.0D0

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

do while (b .GT. a)
  a= a*(1.0D0 + 1.0D-7)
  b= a + 1.0D0
end do

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

end program VF0904