The original question is as follows:

Consider a 12-bit two's complement fixed point representation, with 8 bits for the integer part and 4 bits for the fraction.
What is the binary encoding of the decimal value 45.625?

I found the binary representation for 4510 in 8 bits to be 001011012

I then split the .62510 into a .510 and a .12510

.510 in binary is .12

.12510 in binary is .0012

Therefore, I came up with the final answer of 00101101.10102

However, this was counted incorrect. Where did I go wrong?

  • Looks correct to me. Did they not tell you what they thought the correct answer was?
    – Ixrec
    Jan 14, 2016 at 14:56
  • No, they did not offer a correct answer, unfortunately. If enough people confirm my answer, however, I may approach the instructor and see if the key is incorrect.
    – dirk1212
    Jan 14, 2016 at 14:59
  • Double-check the problem too. The fact that "two's complement" was specified yet the number is positive (and thus, whether it's in two's complement or not makes no difference) puzzled me a bit.
    – Ixrec
    Jan 14, 2016 at 15:03
  • That may have been a trick to try to get us to "flip and add 1" as though it was a negative number. But I'll check on that for sure.
    – dirk1212
    Jan 14, 2016 at 15:05
  • 1
    Ideally, you would go to the instructor note that it is marked incorrect, work through the problem with the instructor, to see what the instructor comes up with, and then check the key again.
    – user40980
    Jan 14, 2016 at 16:23

1 Answer 1


Answer to your question:

If there is any reason why it was counted incorrect, it would be in the notation you used. I don't know what the expected notation was, but binary numbers typically don't have decimal points, so for me the correct answer would simply be 0010 1101 1010 or 001011011010 or even 0b001011011010. I would hope that your professor/teacher would make format requirements clear.

Verifying the answer you received:

The answer you came up with is definitely correct, but I want to give a different approach for achieving the same result. Normally when we convert from binary to decimal we think of powers of two. eg:

(Bit #) (Decimal value)
...       ...
4         16
3         8
2         4
1         2
0         1

But consider the following 'mapping' between bits and decimal numbers:

11   128 (Actually becomes the sign bit in 2s complement)
10   64
9    32
8    16
7    8
6    4
5    2
4    1
.    (just for reference where you're putting the decimal point)
3    0.5
2    0.25
1    0.125 (provided in the example given)
0    0.0625

In your problem statement you say .0012 == .12510. From that, we can actually build the above table. What we're trying to do is come up with a scaling factor between the two tables above. How do we do that? Look at bits in the same position, and make a ratio between the two. In the top table, bit 0 equals 1. In the bottom table, bit 0 equals 0.0625. We choose bit 0 because on one side it's equal to 1 which makes calculations easier. These don't really have units, but if they did it might be something like:

1 standard binary encoding (sbe) = 0.0625 our encoding (oe)

Using our resolution, we can essentially do dimensional analysis on the 'units'. Then we can crunch the calculation (units cancel and we're left with 'sbe'):

45.625 oe * (1 sbe / 0.0625 oe) = 730 sbe

And if you look at the 'standard' binary value of 730, you'll see: 0010 1101 1010 or as you put it in your question: 00101101.1010.

  • Thank you for the excellent answer. The professor did not make the format requirements clear as the example in class contained a decimal, but the homework is considered correct without the decimal. All I had to do was drop it.
    – dirk1212
    Jan 14, 2016 at 19:19
  • 1
    Of course binary numbers don't have decimal points: They have binary points. Jan 14, 2016 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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