[問題]floating point轉fixed point
各位前輩大大好,小弟新手遇到floating point轉fixed point問題
拜讀先前學長留下資料 fixed_point=(fix(d*2^k))/2^k ; % k為小數點位數
倘若小數點預計取三位,下面範例運算完結果 -1.125~=110.110 (-1.125=110.111)
想請教各位前輩為什麼結果二邊不相等呢?
ex. Decimal Binary
-1.135456 110.1101110101........
x2^3 x1000
-9.083648 110110.1110101........
fix(-9.083648)=-9 fix(110110.1110101........)=110110
/2^3 /1000
-1.125 110.110
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.120.90.130
※ 文章網址: https://www.ptt.cc/bbs/MATLAB/M.1452579171.A.FF2.html
推
01/12 22:17, , 1F
01/12 22:17, 1F
→
01/13 12:44, , 2F
01/13 12:44, 2F
→
01/13 12:45, , 3F
01/13 12:45, 3F
推
01/15 04:37, , 4F
01/15 04:37, 4F
→
01/18 15:56, , 5F
01/18 15:56, 5F