Calculating range of two's complement

Course Queries Syllabus Queries 3 years ago

5.59K 2 0 0 0

User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 3 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.

0 views
0 shares

profilepic.png
manpreet 3 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.

Similar Forum