| 查看: 720 | 回复: 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 |
» 猜你喜欢
浙江教授:国内知名学者要尽量少发论文,尽量只研究卡脖子问题-别人做不了的研究
已经有4人回复
我的“飞艇+直升机”专利中了VFS的TVF 2027,求高校师生带写论文并参会
已经有3人回复
做梦
已经有3人回复
» 抢金币啦!回帖就可以得到:
2027年教育大模型与自适应学习系统国际会议(ELALS 2027)
+1/994
2027年经济管理与文化产业国际会议(EMCI 2027)
+1/988
2027年智能计算、机械工程与人工智能国际会议(IMAI 2027)
+1/981
2027年新闻、新媒体与视觉艺术国际会议(NNMVA 2027)
+1/977
2027年社会科学、数字治理与互联网国际会议(SDIP 2027)
+1/966
2027年氢能系统与能源转换国际会议(HSEC 2027)
+1/948
2027年人文发展、文化传播与数据分析国际会议(HDCCDA 2027)
+1/930
2027年量子通信、传感云与信息系统国际会议(CSIS 2027)
+1/927
2027年新媒体发展与经济管理国际会议(MDEM 2027)
+1/920
哈医大生物信息学2027年博士研究生招生
+1/499
南科大薛亚辉课题组诚聘纳米离子学器件方向优秀生源博士生
+1/88
上海87年GG诚求女友
+1/60
征对象
+1/46
科英布拉大学科技学部招收全奖博士研究生
+1/28
厦门大学廖新勤招27年柔性电子相关方向博士生
+5/25
【2027年博士招生】福州大学光催化研究所|光/电催化与扫描电化学显微镜方向
+1/13
北京理工大学 – 无人系统与机器人方向 - 国家级人才团队招收2027年9月入学博士
+1/4
元生OriGene:实现治疗靶点自动化发现的自进化虚拟疾病生物学家
+1/2
做完三级编码,论文还没真正开始
+1/1
【诚聘英才】重庆大学王煜教授课题组诚招科研博士后/教学科研岗教师
+1/1
2楼2011-02-13 10:18:59
3楼2011-02-13 10:24:20









回复此楼