-1
$\begingroup$

How to determine fraction length of fixed-point binary so that distinct entries of a group of decimal numbers (for example: 1, 0.456, 0.444) remain distinct after converting them from decimal to fixed-point binaries?

$\endgroup$
  • $\begingroup$ I don't think that tag is right, but perhaps you can define the terms "fraction length" and "fixed point binary?" $\endgroup$ – Thomas Andrews Jul 22 '14 at 22:07
  • $\begingroup$ @ThomasAndrews Sorry but my reputation is not enough for creating new tag. Also I'm not allowed to leave empty tag. $\endgroup$ – user39086 Jul 22 '14 at 22:12
0
$\begingroup$

You can get a bound by looking at the smallest gap between your numbers. For your example, $0.456-0.444=0.012$ If you use $n$ bits such that $2^{-n} \lt 0.012$ you are guaranteed that the representations will be different after rounding. In this case, we find $n=7, 2^{-n}=0.0078125$ and in fact $0.456 \approx 0.0111010_2, 0.444 \approx 0.0111001_2$, so this is the best we can do. Two numbers that are very close together could round away from each other and fewer bits might be needed. For example, if your numbers were $0.250001$ and $0.249999$ we would think we would need $19$ bits as $2^{-19}\approx 1.9 \cdot 10^{-6} \lt 0.000002$, but in fact $0.249999$ rounds down to $0.0_2$ while $0.250001$ rounds up to $0.1_2$ and we only need one bit.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.