Solving Conversion Issues: -19210 & -458 in 8 bits

  • Thread starter Thread starter jofree87
  • Start date Start date
  • Tags Tags
    Bits Issues
Click For Summary

Discussion Overview

The discussion revolves around converting negative integers, specifically -19210 and -458, into their two's complement representations in 8 bits. Participants explore the challenges of working with numbers outside the typical range of -127 to 128 and discuss potential discrepancies with a textbook's answers.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant expresses confusion over converting -19210, questioning whether to add an extra zero for an 8-bit representation and noting a discrepancy with the book's answer.
  • Another participant points out that -192 requires nine bits, suggesting that the question may be misleading, and provides an alternative interpretation based on C programming.
  • For -458, a participant shares their method of conversion and notes a disagreement with the book's answer, suggesting it may have been based on a different number (-4516).
  • A later reply indicates that the book does not specify the number of bits required for the conversion, raising further doubts about the correctness of the provided answers.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the correct two's complement representations, with multiple competing views regarding the conversions and the validity of the textbook answers. The discussion remains unresolved.

Contextual Notes

There are limitations regarding the assumptions made about the number of bits required for the conversions, as well as the potential for errors in the textbook referenced. The discussion highlights the ambiguity in the problem statement.

jofree87
Messages
37
Reaction score
0
Im having some trouble with these conversions, specifically numbers out of the -127 to 128 range, and numbers with bases that are not 10. My book is asking for the 2's complement of -19210 and -458 in 8 bits. Here is my work.

-19210

19210 = 110000002

(Do I add on another 0 on the left most end here?)

flipping the bits, I get 001111112

adding 1 gives 010000002

the book's answer is 000000102

how are they getting this?
________________________________

-458

For this I tried using the shortcut method and got 458 = 001001012

flipping the bits and adding 1, I get 110110112

the book's answer is 101110112

any help?

sorry about posting 2 questions in one thread, I just didn't want to clutter the forum with problems that were so similar.
 
Physics news on Phys.org
jofree87 said:
My book is asking for the 2's complement of -19210 and -458 in 8 bits.

Hmm. -192 requires nine bits, unless this is a trick question; but even then, if you assign -192 to a "char" variable in C, the answer is 64, not 2.

And I agree with your answer for -458.

What book are you referencing?
 
The book is "Engineering Problem Solving with C++" second edition, by Delores M. Etter and Jeanine A. Ingber.
 
jofree87 said:
-458

For this I tried using the shortcut method and got 458 = 001001012

flipping the bits and adding 1, I get 110110112

the book's answer is 101110112
Looks like the book converted -4516.
 
jofree87 said:
The book is "Engineering Problem Solving with C++" second edition, by Delores M. Etter and Jeanine A. Ingber.

I used Google Books to find the page with the question -- it didn't say anything about the number of bits required (you said 8). I couldn't find the page with the answer, but if it's what you said it is, I don't see how it's right.

I think vela is right about -4516.

Maybe you should look for an errata or try to contact the authors.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 4 ·
Replies
4
Views
5K