Re: [問題] 想請問flash高手...這程式哪裡出問題?

看板Flash作者 (喵)時間19年前 (2006/11/19 15:19), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串6/8 (看更多)
為了證實我的想法 我用下列程式測試 隨機取出兩個數字後 將其中一個除以10另外一個除以100 然後再將兩個都乘以100 接著判斷這兩個數字和她們四捨五入到整數位的數字是否相等 若不相等 列出結果出來 程式如下 ********************************************** _root.onEnterFrame=function () { t1=Math.floor(Math.random()*31)+1; t2=Math.floor(Math.random()*31)+1; t1=t1/10; t2=t2/100; t1=t1*100; t2=t2*100; if(t1!=Math.round(t1)){ trace(t1); trace(Math.round(t1)); trace(t1+"!="+Math.round(t1)); } if(t2!=Math.round(t2)){ trace(t2); trace(Math.round(t2)); trace(t2+"!="+Math.round(t2)); } } function gcd(int1,int2) { a=Math.max(int1,int2); b=Math.min(int1,int2); while(a%b!=0){ c=a-Math.floor(a/b)*b; a=b; b=c; } return b; } ****************************************** 結果trace出來的結果 會有 110 110 110!=110 的狀況 110不等於110 ???? 這真是太奇妙了 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.141.15.61
文章代碼(AID): #15O0Lrgt (Flash)
討論串 (同標題文章)
文章代碼(AID): #15O0Lrgt (Flash)