| 查看: 609 | 回复: 2 | |||
[交流]
【求助】为什么两种写法得到的值不一样?
|
|
为什么把if语句放到不同的位置,结果就不一样了呢?请大家帮忙分析一下,多谢。 写法一(判断语句为h0(t)/=0): t0=0 do ntel=1, npoints neworig = .false. if (t0.eq.0) then neworig = .true. elseif (ntel-time0(t0).eq.it0)then neworig = .true. endif if (neworig) then t0 = t0 + 1 ! update number of t=0 time0(t0) = ntel ! store the time of t=0 h0(t0) = h(ntel) endif do t=1, t0 ! update tcf for t=0 delt=ntel-time0(t)+1 ! actual time minus t=0 if(h0(t)/=0.and.(delt.lt.npoints)) then ntime(delt) = ntime(delt)+1d0 tcf(delt)=tcf(delt)+h(ntel)*h0(t) tcf0(delt)=tcf0(delt)+h0(t)*h0(t) endif enddo enddo 写法二(判断语句为if (h(ntel)/=0) then) t0=0 do ntel=1, npoints neworig = .false. if (h(ntel)/=0) then if (t0.eq.0) then neworig = .true. elseif (ntel-time0(t0).eq.it0)then neworig = .true. endif endif if (neworig) then t0 = t0 + 1 ! update number of t=0 time0(t0) = ntel ! store the time of t=0 h0(t0) = h(ntel) endif do t=1, t0 ! update tcf for t=0 delt=ntel-time0(t)+1 ! actual time minus t=0 if(delt.lt.npoints) then ntime(delt) = ntime(delt)+1d0 tcf(delt)=tcf(delt)+h(ntel)*h0(t) tcf0(delt)=tcf0(delt)+h0(t)*h0(t) endif enddo enddo |
» 猜你喜欢
filecode,4个jtjc了
已经有8人回复
2027广东省杰青
已经有10人回复
朋友圈看到的
已经有8人回复
时间戳变了,能看出什么问题?
已经有14人回复
今天基金会出结果吗?20260819
已经有7人回复
咱们一起用铁证分析2026国家社科基金中标与否
已经有30人回复
今天放榜吗?
已经有11人回复
快农历七夕节了,轻松一下,男人悄悄话,女施主请不要进来。
已经有7人回复
欢迎发来filecode的Mz6后的代码验证其规律
已经有114人回复
什么时候开奖?
已经有6人回复
» 抢金币啦!回帖就可以得到:
散金祈福
+3/1185
五大联赛看好哪支球队
+5/335
散金求好运
+1/294
2026年财务管理、经济与信息技术国际会议 (FMEIT 2026)
+1/285
一点琐碎的家务事,却非常困扰我,让我内耗
+2/110
山东征女友,坐标济南
+1/91
哈尔滨工业大学(校本部)电子与信息工程学院2027级博士招生
+1/80
上海交通大学张航课题组招聘博士后(电化学能量存储与转换)
+1/79
坐标北京诚征男友
+1/66
上海交通大学张航课题组招聘博士后(电化学储能)
+1/46
5年了,散金祈愿面上得中,愿望成真再散十倍
+1/34
中国科学院生态环境研究中心环境工程相关方向招收保送硕士和联合培养博士和硕士研究生
+1/4
27推免-广州医科大学封红亮教授招收精神医学应用心理学推免生
+1/3
南京医科大学-冯璋课题组-招收2027级生化与分子生物学专业博士和硕士研究生
+1/3
清华大学环境课题组招聘环境工作专业客座生研究生2-3名(应用导向)
+1/3
中国科学院生物物理研究所田勇课题组招聘联合培养生
+1/2
河海大学海洋环境污染与生态毒理学研究组招收2027级硕士生 及博士研究生
+1/2
北理工集成电路杰青团队 | 诚招科助理
+1/2
北理工集成电路杰青团队 | 诚招科助理
+1/2
【产品测评分享】体外转录产量不理想、dsRNA 副产物高?T7 RNA 聚合酶实测体验
+1/1
2楼2011-02-13 10:18:59
3楼2011-02-13 10:24:20










回复此楼