| 查看: 631 | 回复: 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 |
» 猜你喜欢
江苏省自然基金 什么时候出结果
已经有5人回复
面上有专家说实验设备不是我们单位的
已经有3人回复
广西大学-广州大学招聘博士后 欢迎广大优秀人才!!!
已经有11人回复
闲聊
已经有3人回复
如何查询2026年获批项目名称?
已经有3人回复
两块石头
已经有10人回复
科研人应该花精力去思考如何解决问题,而不是去凝练问题
已经有19人回复
售SCI一区T0P文章,我:8O.55.1.O.54,科目全,可伽急
已经有15人回复
面上没中,邀请各位路过的虫友分析一下分数
已经有13人回复
初秋的晨风
已经有6人回复
» 抢金币啦!回帖就可以得到:
【征稿中!】2026年机械、制造技术与材料国际会议 (MEMTM 2026)
+1/326
南京大学能源与资源学院景旭东院士团队博士后招聘公告(南京大学苏州校区)
+2/294
招收大湾区大学-哈工深联培博士1名
+1/190
南京大学医学院附属鼓楼医院 肿瘤疫苗与纳米医学团队 博士后招聘
+1/81
北师大珠海校区胡德平课题组保研招生-理论与计算化学方向-2027秋季入学
+1/50
2027级博士研究生——质谱分析
+5/25
上海交通大学膜分离-纳流控课题组诚聘博士后2-3名
+1/22
评职称需要,卖发明专利了:D有技术储备需求的设备厂商可联系
+1/18
哈工大马樱招收2027级计算机类博士生
+1/16
美国弗吉尼亚大学Yang Lab招收Research Scientist, 博后、博士生、技术员、访问学者
+1/14
悉尼科技大学(QS 第87)数据科学/AI招收2027年秋季入学全奖及CSC博士生
+1/10
自己1篇和学生2篇 ,祈福!
+1/9
哈工大马樱招收2027级计算机类博士生
+1/8
福师大化材科研团队招聘青年教师或福建省科研引进生
+1/6
招聘材料计算,分子动力学模拟合作讲师
+1/4
河南省科学院|事业编制|专职科研岗|生物材料 / 生物工程博士 |郑州
+1/3
招聘材料计算,分子动力学模拟相关讲师
+1/3
Paris Saclay university, Dallerac教授团队招收2027CSC–Saclay合作奖学金博士生
+1/2
天津大学浙江研究院2026年第二批招聘公告:高分子等方向特聘青年研究员/博士后
+1/1
招聘材料计算,分子动力学模拟兼职讲师
+1/1
2楼2011-02-13 10:18:59
3楼2011-02-13 10:24:20










回复此楼