討論串[問題] 基本程式設計概念的問題
共 5 篇文章
內容預覽:
well, 只是個四捨五入的差別而已. FPU計算時的四捨五入機制把它處理掉了. 也許要用大一點的數才能看得出差別. (例如1.0/11111111.0再乘回來之類的) (←當然這也是亂說的也沒試過). 講個經典的例子比較能夠感受得到這個問題的重要性:. 幾個月前Excel 2007爆出大Bug.
(還有540個字)
內容預覽:
底下,我用 Dev-C++ 實作,得到的結果和 您的構想不同。. 當然啦!我不會否定 您的想法,我只是想說明一件事,. 程式設計這種東西,一定要實際做過一遍,才能拿來說嘴。. 否則,很容易得到不同的結果。. 我很清楚怎麼 一回事情,這種東西討論起來,. 沒完沒了。. /*. a= 1.000000.
(還有442個字)
內容預覽:
threshold = 0.00001 # 誤差容許值. if (a > b - threshold) and (a < b + threshold). 因為浮點數有精確度的限制. float a = 1;. a /= 3;. a *= 3;. if (a==1) print "Yes"; else
(還有76個字)
內容預覽:
(1) Rewrite the following pseudo-code if statement expression. in a more realistic manner assuming that variables a and b are. of type real:. if (a =
(還有78個字)