# 2’s complement help

• Author
Posts
• #3797
ethicalhack3r
Participant

Hello,

What is the largest positive value that can be represented using a 16-bit 2’s complement representation?

Im sure its wrong tho, any one know the real answer?

• #24271
hayabusa
Participant

Been a while since I’ve done this.  I think you’re one shy, and the answer is 32767.

16-bit would be 1000000000000000, and flipping the bits would yield 0111111111111111, which is equal to 32767 decimal.

To support my thinking, I found the following:

“For instance, a 16-bit word can represent signed integers in the range −32 768 to + 32 767.”

which I took from:

http://openlearn.open.ac.uk/mod/resource/view.php?id=175771

HTH.

(edit – please excuse me if I’m incorrect, and someone tell us otherwise…  been a LONG time since I’d done these, too)

• #24272
ethicalhack3r
Participant

I think your right because 0 is a positive number and I completely forgot about it.

Thanks for the help!  🙂

• #24273
jason
Participant

What was the subject matter of the test, out of curiosity?

• #24274
ethicalhack3r
Participant

Computer System Fundamentals

The whole module was based on the following book:
Fundamentals of Computer Architecture – Mark Burrell (2004)

• #24275
RoleReversal
Participant

Ethicalhack3r,

@ethicalhack3r wrote:

The whole module was based on the following book:
Fundamentals of Computer Architecture – Mark Burrell (2004)

Just out of interest, was Mark Burrell also one of the module lecturers?
I remember some sleep-inducing lectures from him 😀

Andrew

• #24276
ethicalhack3r
Participant

He wasnt one of my lecturers but he used to lecture at Northumbria, think he left a couple of years ago maybe?!

I think its the logic gates that get me nodding off…

• #24277
RoleReversal
Participant

Must have left after my days then, tbh think the whole module got me sleeping.

Wish I’d paid more attention now I’m playing with shellcode, turns out the low-level stuff is still relevant. Who’d of thought the lecturers would have a better understanding of the industry than the students? 🙂