Digit Information Encodeing
- Using discrete symbols or digits
- These are typical binary digits(bits):0 and 1
- we can implement operations like +,>,AND,etc. on binary numbers in hardware very effiently
Encoding Positive Integers
questions:
- how to encoding integers by binary system
- how to represent numbers by hexadecimal
- how do Binary Addition and Binary Subtraction work
- what is “overflow”
- what is modular arithmetic
Encoding Negative Integers
questions:
- how to encode using a sign-magnitude representation
- what issues might this encoding have
Two’s complement Encoding
We can simply relabel some of the digits to represent negative numbers while retaining the nice properties of modular arithmatic
In two’s complement encoding,the high-order of the N-bit representation has nagetive weight:
negative number has “1” in the high-order bit
Arithmetic
negate
invert all the bits and add one
substract
negate the subtrahend and add to the minuend
Example: