Calculating range of two's complement

Course Queries Syllabus Queries 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

This is a computer architecture question given in our college syllabus and i was finding difficulty in solving it. Calculate the range of a 16-bit 2's complement number system for representing both signed and unsigned integers. Please guide me.

profilepic.png
manpreet 2 years ago

For a non negative value, the most significant bit is 0 and the remaining 15 bits represent the value directly.

For a negative value, the most significant bit is 1 and the remaining 15 bits represent the absolute value minus one complemented.

Example for -1:

00000000 00000001 (absolute value)
00000000 00000000 (minus one)
11111111 11111111 (complemented) --> (-1 in 2's complement)

2's complement does not makes sense for unsigned numbers.

For 16 bit unsigned:

Min: 0x0000 --> 0
Max: 0xFFFF --> 65535

For 16 bit signed:

Min: 0x8000 --> -32768
Max: 0x7FFF --> 32767

2's complement is used because it simplifies sums at binary level.

Take these examples:

  00000000 00001010 (10 decimal)
 +11111111 11111001 (-7 decimal)
-------------------
1 00000000 00000011 (3 decimal) (the leftmost 1 is discarded because overflows the 16 bit sum)


  00000000 00001100 (12 decimal)
 +11111111 11101001 (-23 decimal)
-------------------
  11111111 11110101 (-11 decimal)

0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.