Floating point to fixed point

1 次查看(过去 30 天)
freebil
freebil 2013-10-2
Hello. I want to convert some floating point values to fixed point with the best precision i can have for 20 bits. My range of values is [-1000,1000]. I have already rounded my values by using less bits in the mantissa. I used 10 bits(mantissa) and my numbers were pretty close. If i use fixed point numbers, can I make it better? Thanks

回答(1 个)

Walter Roberson
Walter Roberson 2013-10-2
You will need 11 bits to represent the integer portion of -1000 to +1000. That will leave 9 bits of the 20 available for the fraction. It sounds like you want 10 bits after the decimal place. That will not fit.
  2 个评论
freebil
freebil 2013-10-2
Thanks for the answer. Is there any other function than fi?
Walter Roberson
Walter Roberson 2013-10-3
The best precision that you could have in 20 bits would probably be by using floating point instead of fixed point. With 20 bits you would not be able to always get 10 bits after the decimal point: you would get at best 9 bits of precision but those 9 bits of precision might be spaced less than 1/512 apart near 0 (and furthest apart near -1000 and +1000)
Do you need the precision to be uniformly distributed over the range -1000 to +1000, or is there a particular location in there where the spacing between adjacent values should be less than 1/512 (e.g., near 0) ? If so, where, and how much precision near +/- 1000 are you willing to give up to gain extra digits near the important point?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by