浮點數,也是 ㄧ樣。(a + 1) 不一定 > a
by 高顯忠, 2010-12-02 22:04, Views(2186)
| 隱藏詳細資料 21:40 (22 分鐘前) |
program VF0904
implicit none
real a, b
a= 4.0*atan(1.0)
b= a + 1.0
! b= 4.1415926, > 3.1415926, b > a
print *, 'a, b= ', a, b
pause
! -----------------------------------------------------
do while (b .GT. a)
a= a + 1.0
b= a + 1.0
end do
! b <= a, 怎麼可能 (a + 1) <= a
print *, 'exit do while(), b <= a'
print *, 'a, b= ', a, b
pause
end program VF0904
! -----------------------------------------------------
!dec$if(.false.)
a, b= 3.141593 4.141593
Fortran Pause - Enter command<CR> or <CR> to continue.
exit do while(), b <= a
a, b= 1.6777216E+07 1.6777216E+07
Fortran Pause - Enter command<CR> or <CR> to continue.
!dec$endif
implicit none
real a, b
a= 4.0*atan(1.0)
b= a + 1.0
! b= 4.1415926, > 3.1415926, b > a
print *, 'a, b= ', a, b
pause
! ------------------------------
do while (b .GT. a)
a= a + 1.0
b= a + 1.0
end do
! b <= a, 怎麼可能 (a + 1) <= a
print *, 'exit do while(), b <= a'
print *, 'a, b= ', a, b
pause
end program VF0904
! ------------------------------
!dec$if(.false.)
a, b= 3.141593 4.141593
Fortran Pause - Enter command<CR> or <CR> to continue.
exit do while(), b <= a
a, b= 1.6777216E+07 1.6777216E+07
Fortran Pause - Enter command<CR> or <CR> to continue.
!dec$endif