Lecture 03
Lecture 03
➢ Hexadecimal numbers
• Related to binary and octal numbers
➢ Note that each hexadecimal digit can be represented with four bits.
• (1110) 2 = (E)16
➢ Conversion is easy!
• Determine 4-bit value for each hex digit
➢ Note that there are 24 = 16 different values of four bits
➢ Easier to read and write in hexadecimal.
➢ Representations are equivalent!
➢ Plus and minus sign used for decimal numbers: 25 (or +25), -16,
etc.
➢ For computers, desirable to represent everything as bits.
➢ Three types of signed binary number representations: signed
magnitude, 1’s complement, 2’s complement.
➢ In each case: left-most bit indicates sign: positive (0) or negative (1).
➢ Machines that use 2’s complement arithmetic can represent integers in the range
-2n-1 <= N <= 2n-1-1
where n is the number of bits available for representing N. Note that 2n-1-1 =
(011..11)2
and –2n-1 = (100..00)2
➢ For 2’s complement more negative numbers than positive.
➢ For 1’s complement two representations for zero.
➢ For an n bit number in base (radix) z there are zn different unsigned values.
(0, 1, …zn-1)
Ignore
Ignore
Carry
CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 16
2’s Complement Subtraction: Example #2
1 0 1 0 0 0
1 1 0 0 1
➢ Here, there is no carry bit and the sign bit is 1.
This indicates a negative result, which is what we
expect. (11001)2 = -(7)10.