Signed Integers (Cont.)
Converting Signed Decimal to Hexadecimal
Convert the absolute value of the decimal integer to hexadecimal.
If the original decimal integer was negative, form the two's complement of the hexadecimal number.
Starting value:
(-1462)
10
(-1462)
10
Step 1
: Convert the absolute value to hexadecimal
Step 2
: Reverse the digits
Step 3
: Add 1 to the value from Step 2
+
0
0
0
1
Step 4
: Form the two's complement
2's complement notation of (-1462)
10
is
(
)
16
Converting Signed Hexadecimal to Decimal
If the highest bit is a 0, convert the unsigned hexadecimal integer to decimal.
If the highest bit is a 1, it is stored in two's complement notation.
Starting value:
(8A20)
16
8
A
2
0
Step 1
: Reverse the digits
Step 2
: Add 1 to the value from Step 1
+
0
0
0
1
Step 3
: Form the two's complement
Step 4
: Convert to decimal
negative (
)
16
= (
)
10
Maximum and Minimum Values
A signed integer of
n
bits uses only
n
-1 bits to represent its magnitude.
Storage Type
Maximum Values
Minimum Values
Signed byte
(01111111)
2
= 2
7
– 1 = (127)
10
(10000000)
2
= -2
7
= (-128)
10
Signed word
(0111111111111111)
2
= 2
15
– 1 = (32,767)
10
(1000000000000000)
2
= -2
15
= (-32,768)
10