Conversion: Decimal Binary Hexadecimal Addition in Other Bases
Conversion: Decimal Binary Hexadecimal Addition in Other Bases
(10010101)2
+ (00110110)2
Representing negative numbers
In binary, the left-most bit is often used to represent the sign (whether the
number is positive or negative). This is called a signed integer:
• 0 means the number is positive 2) Add the following two binary numbers:
• 1 means the number is negative
(01101111)2
Unsigned vs signed integers + (00111111)2
Consider that we are working with 8-bit integers (1-byte):
• a signed integer uses the leftmost bit to represent the sign, and the
remaining 7-bits to represent the magnitude of the number
• an unsigned integer uses all 8 bits to represent the magnitude 3) Add the following two hexadecimal numbers:
Example:
(1A57)16
+ (32C4)16
What are the trade-offs associated with using signed or unsigned integers? 4) Add the following two hexadecimal numbers:
(49EC)16
+ (7F3D)16
Created by Anthony Estey – Used by Miguel Nacenta
CSC 106 – Unit 2: Numbers
10101101
- 00011010
DEA9
-4FBD
Let’s take a look in binary: