| 查看: 572 | 回复: 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 |
» 猜你喜欢
这种情况还有戏吗
已经有11人回复
微信指数没变化,科研之友没阅读
已经有4人回复
同事接到电话了,我却没有
已经有4人回复
准备明年的基金了
已经有5人回复
今年的WR进展到哪一步了?
已经有6人回复
时间戳他又来了
已经有11人回复
小木虫看见有人已经知道结果了
已经有15人回复
这个自发加氧反应的机理是什么?
已经有6人回复
J-J-W不为人知的一面
已经有18人回复
没消息就是被刷了呗
已经有13人回复
» 抢金币啦!回帖就可以得到:
求助2013年-2011年,武汉哪所学校的实验室合成过单价3万/克(或毫升)的剧毒成品?
+5/3270
求助2013年-2011年,武汉哪所学校的实验室合成过单价3万/克(或毫升)的剧毒成品?
+5/2420
浙江理工大学能源催化团队诚聘专职教师/博士后
+2/214
Postdoctoral fellow in Medicinal Chemistry, McGill University
+1/76
上海 东华大学 刘栋良 招 2027 学术型博士(化学专业)
+1/74
坐标北京,诚征女友
+2/56
西湖大学拓扑光学、非厄米光学、太赫兹方向博士后招聘(长期有效)
+5/55
大连理工大学化学学院界面介导黏附与组装课题组招收推免生
+1/31
坐标南京
+1/30
西安交通大学补亚忠课题组招聘2027年博士生
+1/27
厦门大学化学化工学院廖洪钢课题组招聘助理1名(全职)
+1/27
西安交通大学补亚忠课题组招收申请考核制博士生
+2/26
诚征女友( 西安 )
+1/25
西安交通大学补亚忠课题组招收申请考核制博士生
+2/20
浙江大学医学院附属妇产科医院张霈婧课题组招科研助理——生物信息方向
+2/14
招生宣讲会倒计时!7月29日20:00,不见不散!
+1/12
新西兰坎特伯雷大学招博士后
+1/7
(Scopus期刊)Biofunctional Materials《生物功能性材料》招募青年编委及征稿
+1/6
澳大利亚UNSW Ming Li课题组招生生物传感、纳米药物、微流控方向博士生(2026-2027)
+1/2
中科院大连化物所诚聘博士后/科研助理/项目聘用人员
+1/2
2楼2011-02-13 10:18:59
3楼2011-02-13 10:24:20











回复此楼