Floating point to fixed point

1 visualizzazione (ultimi 30 giorni)
freebil
freebil il 2 Ott 2013
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

Risposte (1)

Walter Roberson
Walter Roberson il 2 Ott 2013
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 Commenti
freebil
freebil il 2 Ott 2013
Thanks for the answer. Is there any other function than fi?
Walter Roberson
Walter Roberson il 3 Ott 2013
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?

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by