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.
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.
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 = 27 – 1 = (127)10 |
(10000000)2 = -27 = (-128)10 |
Signed halfword |
(0111111111111111)2 = 215 – 1 = (32,767)10 |
(1000000000000000)2 = -215 = (-32,768)10 |
“A man is not called wise because he talks and talks again;
but if he is peaceful, loving and fearless then he is in truth called wise.”
― Dhammapada, The Dhammapada: The Sayings of the Buddha
|