| 查看: 464 | 回复: 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 |
» 猜你喜欢
情人节自我反思:在爱情中有过遗憾吗?
已经有10人回复
今年春晚有几个节目很不错,点赞!
已经有7人回复
基金正文30页指的是报告正文还是整个申请书
已经有5人回复
过年走亲戚时感受到了所开私家车的鄙视链
已经有5人回复
» 抢金币啦!回帖就可以得到:
坐标广州,征女友
+2/140
ChineseResearchLaTeX: 开源、免费的vibe coding辅助国自然写作
+1/81
海法大学线上开放日
+1/34
清华大学深圳国际研究生院招聘-博士后(长期有效)
+1/28
海南大学海洋技术与装备学院-科研助理招聘(可读博)膜分离水处理方向
+1/28
英国布里斯托大学诚招博士生,博士后和联合培养生
+1/18
2026年天津科技大学“新能源催化与膜材料团队”研究生招生
+1/18
太原理工大学集成电路学院招收2026年博士研究生
+1/15
上海交通大学-宁波东方理工大学联合培养博士生 – 力学
+1/10
湖南大学-分析检测技术和生物柔性传感器-招收1名博士研究生 (2026年,第二批)
+1/7
26申博自荐求博导-生物传感分析方向
+1/6
中北大学冯瑞教授*开山大弟子*招募
+1/5
墨尔本大学(QS13)急招CSC博士(补齐全奖)/访问学者/博士后 (材料/生物医学/器官芯片等)
+1/4
怎么发布了求助贴了, 一发就转到删除栏了
+1/4
澳科大招收2026年秋季药物递送/生物材料方向硕士研究生(3月5日18:00报名截止)
+1/3
中国科学技术大学 工程科学学院 国家级人才团队 诚聘博士后
+1/3
德国图宾根大学诚招全奖岗位制博士(地下流固化学反应耦合数值模拟方向)
+1/2
【科研助理招聘-北京理工大学-集成电路与电子学院-国家杰青团队】
+1/1
澳科大招收2026秋季全奖博士研究生(药剂学/生物材料方向,3月5日18:00截止)
+1/1
上海大学生物有机电子材料及器件团队博士研究生招聘
+1/1
2楼2011-02-13 10:18:59
3楼2011-02-13 10:24:20













回复此楼