Computer Science AS OCR
-
1-1-structure-and-function-of-the-processor as5 主题
-
1-2-types-of-processor as3 主题
-
1-3-input-output-and-storage as2 主题
-
2-1-systems-software as8 主题
-
2-3-software-development as5 主题
-
2-4-types-of-programming-language as4 主题
-
3-1-compression-encryption-and-hashing as3 主题
-
3-2-databases as3 主题
-
3-3-networks as8 主题
-
3-4-web-technologies as13 主题
-
html as
-
css as
-
css-styling as
-
javascript as
-
variables-and-constants-in-javascript as
-
outputs-in-javascript as
-
selection-in-javascript- as
-
for-loops-in-javascript- as
-
while-loops-in-javascript- as
-
strings-in-javascript- as
-
operators-in-javascript- as
-
nested-statements-in-javascript as
-
functions-and-procedures-in-javascript as
-
html as
-
4-1-data-types as8 主题
-
4-2-data-structures as4 主题
-
4-3-boolean-algebra as1 主题
-
5-1-computing-related-legislation as4 主题
-
5-2-moral-and-ethical-issues as9 主题
-
6-1-thinking-abstractly as3 主题
-
6-2-thinking-ahead as1 主题
-
6-3-thinking-procedurally as3 主题
-
6-4-thinking-logically as2 主题
-
6-5-thinking-concurrently as2 主题
-
7-1-programming-techniques as9 主题
-
8-1-standard-algorithms-and-big-o-notation as8 主题
negative-binary-numbers- as
Exam code:H046
Signed Binary Numbers
What are signed binary numbers?
-
A binary number can be signed or unsigned:
-
Unsigned – used to represent positive binary numbers
-
Signed – used to represent both positive and negative binary numbers
-
-
We can use signed binary numbers to represent negative numbers using methods such as:
-
Sign & magnitude
-
Two’s complement
-
-
Both of these methods use the Most Significant Bit (MSB) to represent whether the number is negative or positive:
-
If the MSB is 0, the number is positive
-
If the MSB is 1, the number is negative
-
Sign & Magnitude
-
Sign & magnitude binary numbers contain a:
-
Sign – This is when the MSB is used to represent whether the number is negative (1) or positive (0)
-
Magnitude – This is used to describe the rest of the bits after the MSB
-

Representing negative binary numbers using sign & magnitude
Binary to denary example
-
To convert a sign & magnitude binary number to denary, you need to:
-
Convert the number as normal from binary to denary (as described in Positive Binary number: Binary to Denary)
-
Apply the MSB at the end of the calculation
-
If the MSB is 1, the number is negative
-
If the MSB is 0, the number is positive
-
-

Converting sign & magnitude binary numbers to denary
Denary to binary example
-
To convert a denary number to a sign & magnitude binary number, you need to:
-
Identify whether the number is positive or negative
-
Convert the number to binary as normal (as described in Positive Binary Numbers: Denary to Binary)
-
If the number is negative, change the MSB to 1
-
|
MSB |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|---|---|---|---|---|---|---|---|
|
1 |
1 |
0 |
0 |
0 |
1 |
1 |
1 |
-
64 + 4 + 2 + 1 = 71
-
Apply a sign of 1 to make -71
-
Therefore the denary number -71 in binary is 11000111
A consequence of using a sign bit
-
The MSB purpose changes from representing a value to representing positive or negative
-
Losing the MSB halves the maximum size of the number that can be stored
-
However, as a benefit it makes it possible to represent negative numbers

Sign & magnitude number system
Worked Example
Convert the 8-bit sign and magnitude binary number 10001011 to denary.
How to answer this question:
-
Identify the sign bit: The MSB is 1, so the number is negative
-
Isolate the magnitude: We are left with 0001011 by removing the sign bit
-
Convert to denary: The binary number 0001011 converts to 11 in denary
-
Apply the sign: The MSB was 1, so the number is -11 in denary
Answer:
Answer that gets full marks
10001011 converts to -11 in denary
Two’s Complement
-
Two’s complement is a different method for representing negative binary numbers
-
Calculations on two’s complement numbers are less computationally intensive
Method
-
Start with the absolute value of the number, in this case 12
-
Invert the bits so that all of the 1’s become 0’s and all of the 0’s become 1’s
-
Add 1

Representing two’s complement binary numbers
-
The purpose of the MSB has changed; it now represents the negative starting point of the number, and the rest of the bits are used to count upwards from that number
-
Using the binary number from the image above:
-
Begin counting at -16
-
Add 4 to make -12
-
-
Two’s complement has a similar consequence to sign and magnitude as the maximum value of an 8-bit value is halved
Denary to binary example
-
To convert the denary number -24 to a two’s complement binary number, you need to:
-
Convert the number to binary
-
|
-128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|---|---|---|---|---|---|---|---|
|
0 |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
-
Invert the bits
|
-128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|---|---|---|---|---|---|---|---|
|
1 |
1 |
1 |
0 |
0 |
1 |
1 |
1 |
-
Add 1 to the number
|
-128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|---|---|---|---|---|---|---|---|
|
1 |
1 |
1 |
<p |
Responses