作者sjgau (sjgau)
看板Fortran
標題[心得] (x + 1) > x, 那可 不一定
時間Mon Sep 8 20:36:57 2008
real 的變數宣告,default is 4- bytes real,
有效位數,精確度 只有 6 - 7位
所以,。。。
!dec$if (.false.)
1.6976348E+07 1.6976348E+07
Press any key to continue
!dec$endif
! -----------------------------------------------
program CF0610
implicit none
real x, y
x= 4.0*atan(1.0)
y= x + 1.0
! y > x
do while (y .GT. x)
x= x*1.0001
y= x + 1.0
end do
! y <= x
write(*, *)x, y
end program CF0610
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.231.16.169