| 查看: 454 | 回复: 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 |
» 猜你喜欢
救命帖
已经有7人回复
限项规定
已经有6人回复
西南交通大学国家级人才团队2026年博士研究生招生(考核制)—机械、材料、力学方向
已经有3人回复
英文综述是否需要润色及查重
已经有5人回复
为什么nbs上溴 没有产物点出现呢
已经有9人回复
招博士
已经有3人回复
最失望的一年
已经有18人回复
» 抢金币啦!回帖就可以得到:
限广州,征女友
+2/136
广东工业大学自动化学院鲁仁全教授团队刘勇华老师招收2026年博士研究生(申请制)
+1/84
南京林业大学特聘教授团队招聘博后和2026博士研究生
+1/80
大连理工大学智能系统实验室优秀硕博研究生招生
+1/78
南昌大学化学化工学院付拯江教授拟招收“申请-考核”制博士研究生
+1/72
辽宁材料实验室框架复合材料课题组招收联合培养研究生(长期有效)
+2/48
电子科技大学崔春华课题组招收物理化学背景博士生1名-申请考核制
+2/46
上海交通大学 碳纳米管、阵列、器件应用博士后招聘
+1/32
东北林业大学刘松教授课题组长期招收博士、博士后
+1/31
西交利物浦大学黄彪院士招收26年全奖博士生1名(工业智能方向)
+1/31
[长期合作招募] 同济大学肖倩老师团队诚邀港澳学者学术交流
+1/25
顾敏院士课题组招收2026级光学工程专业博士研究生-上海理工大学智能科技学院
+1/22
博士后, 博士招生 美国大纽约地区 NJIT
+1/15
哈尔滨工业大学(深圳)-包斌招收2026年博士研究生及博士后
+1/9
2025版《中国药典》方法测定二甲基亚砜含量偏高
+1/5
中国计量大学叶德茂课题组招收博士研究生(欢迎计算机类、电子信息类等专业)
+1/4
南开大学齐迹课题组诚聘分子生物学、免疫学、有机分子合成相关方向的博士后和研究生
+1/3
自荐:大模型ai辅助论文阅读软件:EasyReader论文易读
+1/3
南开大学齐迹课题组诚聘分子生物学、免疫学、有机分子合成相关方向的博士后、博士硕士
+1/2
标准求助 SN/T 5263-2020悬赏10个金币
+1/2
2楼2011-02-13 10:18:59
3楼2011-02-13 10:24:20













回复此楼