Re: [問題] 想請問flash高手...這程式哪裡出問題?
為了證實我的想法
我用下列程式測試
隨機取出兩個數字後
將其中一個除以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
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 6 之 8 篇):
Flash 近期熱門文章
PTT數位生活區 即時熱門文章