Re: [問題] 準確度問題
改成
2^1 2^3 2^5 2^7 2^9 2^49
----- - ----- + ----- - ----- + ----- .... ------
2! 4! 6! 8! 10! 50!
program Console4
implicit none
integer:: i,c
real(kind=8)::ss,a
ss=0
a=0.5
c=-1
do i=1,100
a=a/i
if(i/2*2==i)then
a=a*4
c=c*-1
ss=ss+c*a
write(*,*)i/2,ss
endif
enddo
end program Console4
1 1.00000000000000
2 0.666666666666667
3 0.711111111111111
4 0.707936507936508
5 0.708077601410935
6 0.708073325851104
7 0.708073419819452
8 0.708073418253313
9 0.708073418273785
10 0.708073418273570
11 0.708073418273571
12 0.708073418273571
13 0.708073418273571
14 0.708073418273571
15 0.708073418273571
16 0.708073418273571
17 0.708073418273571
18 0.708073418273571
19 0.708073418273571
20 0.708073418273571
21 0.708073418273571
22 0.708073418273571
23 0.708073418273571
24 0.708073418273571
25 0.708073418273571
26 0.708073418273571
27 0.708073418273571
28 0.708073418273571
29 0.708073418273571
30 0.708073418273571
31 0.708073418273571
32 0.708073418273571
33 0.708073418273571
34 0.708073418273571
35 0.708073418273571
36 0.708073418273571
37 0.708073418273571
38 0.708073418273571
39 0.708073418273571
40 0.708073418273571
41 0.708073418273571
42 0.708073418273571
43 0.708073418273571
44 0.708073418273571
45 0.708073418273571
46 0.708073418273571
47 0.708073418273571
48 0.708073418273571
49 0.708073418273571
50 0.708073418273571
請按任意鍵繼續 . . .
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.116.138.214
→
11/09 11:38, , 1F
11/09 11:38, 1F
→
11/09 11:38, , 2F
11/09 11:38, 2F
推
11/10 01:07, , 3F
11/10 01:07, 3F
討論串 (同標題文章)
Fortran 近期熱門文章
PTT數位生活區 即時熱門文章
-1
12