• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

YAHWT: Binary complements

Kirby

Lifer
Just a quick question.

Determine the decimal values of the following 1's complement numbers:

0111011110

For 1's complement all you do is switch the 1's and 0's. So you get:

1000100001 = (1*2^9) + (1*2^5) + (1*2^0) = 545

But the back of the book gives 478, which I thought was the original decimal value, not the complement. Any thoughts? Am I an idiot? Is the author an idiot?
 
Thanks. What about this one?

1011100111

The complement is 0100011000, so the anwer is 280. The back of the book gives -280, is that because the first digit of the original is 1? If it's 0, the number is positive?
 
The book is right.
1st question you don't do anything but convert to decimal.

2ns question when the first digit is a 1 then you take the complement and the result is always negitive.
 
Originally posted by: smack Down
The book is right.
1st question you don't do anything but convert to decimal.

2ns question when the first digit is a 1 then you take the complement and the result is always negitive.

So if the first digit is 0, you don't need to take the complement, but if the first digit is 1, you do?
 
Originally posted by: nkgreen
Originally posted by: smack Down
The book is right.
1st question you don't do anything but convert to decimal.

2ns question when the first digit is a 1 then you take the complement and the result is always negitive.

So if the first digit is 0, you don't need to take the complement, but if the first digit is 1, you do?

Correct, same applies for 2's complement.
 
Originally posted by: Skeeedunt
Aren't you supposed to add a one in there somewhere?

2's complement is a little different. From what my professor explained, start at the right and go until you reach a 1, everything to the left changes and everything to right stays the same.

1011100111 => 0100011001

The last one stays the same because its the first 1 on the left.

Correct?
 
Originally posted by: nkgreen
Originally posted by: Skeeedunt
Aren't you supposed to add a one in there somewhere?

2's complement is a little different. From what my professor explained, start at the right and go until you reach a 1, everything to the left changes and everything to right stays the same.

1011100111 => 0100011001

The last one stays the same because its the first 1 on the left.

Correct?

Yea that's correct. You can also invert the bits and add 1 to get the same thing.
 
Originally posted by: nkgreen
Originally posted by: Skeeedunt
Aren't you supposed to add a one in there somewhere?

2's complement is a little different. From what my professor explained, start at the right and go until you reach a 1, everything to the left changes and everything to right stays the same.

1011100111 => 0100011001

The last one stays the same because its the first 1 on the left.

Correct?

2s compliment = take the 1s compliment and add 1 (or is it the other way around?)

but i like the shortcut way
 
Back
Top