Number Systems |
Binary Values
- Binary values are numbers represented using base 2
- The values are represented using just the digits 0 or 1.
- A binary value can unsigned or signed
- A binary value with a fractional part can be represented as a fixed point or floating point notation
Unsigned Binary Values
- Unsigned binary values represent only positive values
- An n-bit unsigned binary number can represent denary values from 0 to 2n-1
Signed Binary Values
- Signed binary values represent both positive and negative values.
- An n-bit signed binary number can represent denary values from -(2n-1) to 2n-1-1
Fixed Point Binary Notation
- Fixed point binary notation places a binary point at a specific place in the number
Fixed Point Binary Notation
- Floating point binary notations uses a mantissa and an exponent to represent the number
- The size of the mantissa and the exponent are both signed binary values of a predetermined size using the two's complement notation
- The mantissa is a fixed point binary value with the binary point directly after the most significant digit
- The exponent is an integer
- The binary value represented by the mantissa and exponent is (mantissa) × 2exponent
Binary Conversion
For a fixed point binary value find:
- The one's complement
- The two's complement
- The denary representation
- The hexadecimal representation
Binary number format
Representations
Binary Representation | 0000 0000 |
Denary Representation | 010 |
Hexacimal Representation |
0016 |
One's Complement | 1111 1111 |
Two's Complement | 0000 0000 |
Two's Complement
Two's completement is a method used to represent signed binary numbers with the most significant digit on the left determining whether the value is positive (0) or negative (1).
The are two common methods to calculate the two's completement of a number, i.e. to find the negative notation of a positive number or the positive notation of a negative number.
Calculating the Two's Complement of 0000 0000
Method 1
Calculate the one's complement by flipping every bit and then add 1
| One's Complement of Binary Value | |||||||
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
Signed Binary Value | 0000 0000 |
One's Complement |
1111 1111 |
Calculation |
1111 1111 + 0000 0001 |
Two's Complement |
0000 0000 |
Method 2
Scan from the right until a 1 is reached, then flip every bit after that.
| Two's Complement of Binary Value | |||||||
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Signed Binary Value | 0000 0000 |
Bits not flipped |
0000 0000 |
Bits to flip |
0000 0000 |
Two's Complement |
0000 0000 |
Conversion to Denary
An unsigned binary value can be converted to the equivalent positive denary value (decimal number) by summing the values of the columns that contain a 1 in it.
For an unsigned 8-bit binary value, the range of possible values is from 0 to 255.
Converting the binary value 0000 0000 to denary
Method
- The value of each binary column is 2n
- The denary value is the sum of the values of each column containing the binary digit 1
| Unsigned Binary Value | ||||||||
|---|---|---|---|---|---|---|---|---|
| n | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 |
| Value | 64 | 32 | 16 | 8 | 4 | 2 | 1 | 128 |
| Binary | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Binary Value | 0000 0000 |
Denary Conversion | |
Denary Value | 010 |
Conversion to Hexadecimal
Hexadecaimal digits can be represented with a 4-bit binary values.
Binary values can be converted to the equivalent hexadecimal value by working from right to left into and placing them in groups of 4 bits
The 4-bit groups are then replaced with the equivalent hexadecimal value
| Hexadecimal Digits | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Hexadecimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
| Binary | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
Alternatively, if the binary value is negative, then the equivalent positive binary value can be found by taking the two's complement of it. The denary value is the negative of this number.
For an signed 8-bit binary value, the range of possible values is from 0to 255.
Converting the binary value 0000 0000 to denary
Method
- The value of each binary column is 2n except for that of the most significant bit
- The value of the most significant bit in the far left column takes the value -2n
- To find the denary value of the binary number, add the value of each column containing the
binary digit 1
- When the value in the far left column is 0, then the number is positive
- When the value in the far left column is 1, then the number is negative
| Signed Binary Representation | ||||||||
|---|---|---|---|---|---|---|---|---|
| n | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| Value | 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 |
| Binary | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Signed Binary Value | 0000 0000 |
Denary Conversion | |
Denary Value | 010 |
