I'm a cs student and i've just started learning about binary arithmetic.I have to do this homework assignement to get prepared for exams..I'm having some trouble figuring out how to convert a negative floating point number in binary system....I was thiking about IEEE-754 representation but i must use only two's complement method...other than that i'm not really sure if my calculations are right ...I'm really confused.

So the exercise is:

1.Convert a=-9, b=+3.75, c= -1.25, d=+10.2 in binary using two's complement representation.For integer part you must use the minimum number of bits and for the fractional part only 4 bits.

2.Convert the above numbers in signed magnitude representation (in binary)

3.Calculate a-a , b+c , c+a using two's complement of question (1)

my solution:

1.9 as unsigned int in binary: 1001 so +9 is : 01001

-9 is : inversion of bits and then add 1 so : 01001 --> 10110+1-->10111

so a=10111

+3.75: 3 is 11 so +3: 0011 and 0.75: 0.11

together--> 0011.11 is this right? I think it should be 11.11 cause we want the minimum bits


-1.25 : 1 is 1 in binary so +1: 0001 and 0.25 is : 0.01

together --> 0001.01

(Again i think it should be 01.01 or 1.01 )

then i invert the bits so 0001.01 --> 1110.10+0.01--> 1110.11


Is this how we do it?

+10.2 : 10 is 1010 in binary so +10: 01010 and 0.2 is : 0.0011

together--> 01010.0011


2.Signed magnitude representation

-9 : 10110

+3.75 its the same : 0011.11

-1.25 : ????

+10.2 its the same : 1010.0011


a=-9 which means -a=9 so i have to do -9+9 and in binary:

10111+01001=100000...we discard 1 so result is 00000 which is 0 in decimal


(I added 4 bits after point cus fractional part must have 4 bits as it says)

0011.1100+1110.1100=10010.1000 we discard 1 so result is 0010.1000 and in decimal 2.5


01110.1100+10111.0000=100101.1100 we discard 1 so result is 00101.1100 but in decimal 00101 isn't -10 but 5 . I can't detect my mistake

I don't know if any of the above is right,so please correct me.Any help would be much appreciated!

  • 1
    $\begingroup$ We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher. $\endgroup$ – D.W. Jun 10 '18 at 19:38
  • $\begingroup$ 01110.1100+10111.0000=100101.1100 -- I can't follow the Q's and A's, but this looks like 14.75-9=5.75. No mistake? $\endgroup$ – dcromley Jun 12 '18 at 1:07

Your Answer

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

Browse other questions tagged or ask your own question.