→ dok:Matlab很多函式都有數值計算的問題,ex:算eigenvalue 12/07 15:02
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.120.14.167
a mod b = 0, but a/b卻不整除
發生在b不是整數且b的倍數非常接近a時
ex: a=-2.3561944901923453,b=0.0087266462599716477
mod(a,b)=0, a/b=-270.00000000000006
Matlab的help裡也有說了
MOD(x,y) is x - n.*y where n = floor(x./y) if y ~= 0. If y is not an
integer and the quotient x./y is within roundoff error of an integer,
then n is that integer.
也就是會有誤差,希望有用到mod寫程式的可以注意一下
找出這問題找了半天.....
--