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

In summary, the conversation discusses the 2's complement of -19210 and -458 in 8 bits, with the book providing an answer of 000000102 and 101110112 respectively. However, there is confusion over the number of bits required for -192 and the correctness of the book's answer for -458, with -4516 being a possible alternative. It is suggested to check for errata or contact the authors for clarification.
  • #1
jofree87
38
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
  • #2
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?
 
  • #3
The book is "Engineering Problem Solving with C++" second edition, by Delores M. Etter and Jeanine A. Ingber.
 
  • #4
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.
 
  • #5
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.
 

1. What are the possible causes of conversion issues for -19210 and -458 in 8 bits?

The main cause of conversion issues for these numbers is that they cannot be represented accurately in 8 bits. This means that the number of bits available for storage is not enough to represent the full value of these numbers, resulting in an incorrect conversion.

2. How can these conversion issues be solved?

One solution is to increase the number of bits used for storage. For example, using 16 bits would allow for a more accurate representation of these numbers. Another solution is to use a different data type, such as floating-point numbers, which can handle a wider range of values.

3. Can the conversion issues be fixed without changing the number of bits or data type?

In some cases, it may be possible to use techniques such as rounding or truncation to approximate the values of -19210 and -458. However, this may result in a loss of precision and may not always be a reliable solution.

4. Are there any other factors that can affect conversion accuracy?

Yes, there are several other factors that can impact conversion accuracy, such as the specific programming language or compiler being used, the underlying hardware architecture, and the specific method or algorithm used for the conversion.

5. Is it common to encounter conversion issues in scientific data analysis?

Yes, it is not uncommon to encounter conversion issues, particularly when working with large or complex datasets. It is important for scientists to be aware of these issues and to use appropriate techniques and tools to ensure accurate conversions and analysis of their data.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
627
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
922
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
Back
Top