我在debug程式時發現數值在作運算時有些問題
在即時運算視窗下的內容為
?temp(1,1)
36.9432275158825
?tol_mu(1)
12.3144091719608
?temp(1,1)/tol_mu(1)
3 <------------為什麼這裡運算出來的結果是整數ㄋ?
?36.94/12.31
3.00081234768481 <-----這答案似乎比較正確
想請問大家要怎麼解決這問題?
另外
我如何讓temp(1,1)只顯示出小數點後四位?
thanks
ps. temp與tol_mu宣告為double
在即時運算視窗下的內容為
?temp(1,1)
36.9432275158825
?tol_mu(1)
12.3144091719608
?temp(1,1)/tol_mu(1)
3 <------------為什麼這裡運算出來的結果是整數ㄋ?
?36.94/12.31
3.00081234768481 <-----這答案似乎比較正確
想請問大家要怎麼解決這問題?
另外
我如何讓temp(1,1)只顯示出小數點後四位?
thanks
ps. temp與tol_mu宣告為double
文章標籤
全站熱搜

Dim temp(1, 1) As Double, tol_mu(1) As Double temp(1, 1) = 36.9432275158825 tol_mu(1) = 12.3144091719608 Print temp(1, 1) Print tol_mu(1) Print temp(1, 1) / tol_mu(1) temp(1, 1) = 36.94 tol_mu(1) = 12.31 Print temp(1, 1) / tol_mu(1) Print 36.94 / 12.31
Dim temp(1, 1) As Double, tol_mu(1) As Double temp(1, 1) = 36.9432275158825 tol_mu(1) = 12.3144091719608 Print Round(temp(1, 1),4) Print Round(tol_mu(1),4) Print temp(1, 1) / tol_mu(1) temp(1, 1) = 36.94 tol_mu(1) = 12.31 Print temp(1, 1) / tol_mu(1) Print 36.94 / 12.31 36.9432 12.3144 3.00000000000001 3.00081234768481 3.00081234768481