Jump to content

HELP! IS this correct?

Featured Replies

Convert 7 and -7.25 to twos complement with 6 bits and add them.So , -7.25 is smth like 1001,01. When I add 000111 to it,the result is 1000,01...and if i convert this to twos complement the result is not -0.25...whats wrong?

  • Author

You have -7.25 incorrect, I think you have -6.75. Remember to include the fraction in the base 2 7 as well.

 

But if I add another 1,then I won't have 6 bits but 7 bits :S

Convert 7 and -7.25 to twos complement with 6 bits and add them.So , -7.25 is smth like 1001,01. When I add 000111 to it,the result is 1000,01...and if i convert this to twos complement the result is not -0.25...whats wrong?

 

I am not sure why you think it is ok to spam the forum like this. This is the third post on essentially the same subject, the last two posts being identical.:mad:

 

Since you are now using a fractional representation we can consider the number as being scaled by x4.

7 x 4 = 28 --> 011100 using 6 bit signed binary

-7.25 x 4 = -29 -> 100011 using 6 bit signed binary

Add to give -1 -> 111111 using 6 bit signed binary

 

It would be much easier to use standard word sizes, 8/16/32 etc, as then you can just use a binary calculator to do the working.

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.