0% found this document useful (0 votes)
16 views15 pages

Binary Number Systems Explained

The document provides an overview of data representation, focusing on binary and various number systems including binary-coded decimal and hexadecimal. It explains how binary numbers are used in computers, methods for converting between binary and decimal, and techniques for representing negative numbers using one’s and two’s complement. Additionally, it covers binary addition and subtraction, emphasizing the importance of understanding binary arithmetic in computing.

Uploaded by

ariel.serenado
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views15 pages

Binary Number Systems Explained

The document provides an overview of data representation, focusing on binary and various number systems including binary-coded decimal and hexadecimal. It explains how binary numbers are used in computers, methods for converting between binary and decimal, and techniques for representing negative numbers using one’s and two’s complement. Additionally, it covers binary addition and subtraction, emphasizing the importance of understanding binary arithmetic in computing.

Uploaded by

ariel.serenado
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

1 Data representation
1 Key terms
Binary – base two number system based on the values Memory dump – contents of a computer memory output
0 and 1 only. to screen or printer.
Bit – abbreviation for binary digit. Binary-coded decimal (BCD) – number system that
One’s complement – each binary digit in a number is uses 4 bits to represent each denary digit.
reversed to allow both negative and positive numbers to ASCII code – coding system for all the characters on a
1 Information representation and multimedia

be represented. keyboard and control codes.


Two’s complement – each binary digit is reversed and Character set – a list of characters that have been
1 is added in right-most position to produce another defined by computer hardware and software. It is
method of representing positive and negative numbers. necessary to have a method of coding, so that the
Sign and magnitude – binary number system where computer can understand human characters.
left-most bit is used to represent the sign (0 = + and Unicode – coding system which represents all the
1 = –); the remaining bits represent the binary value. languages of the world (first 128 characters are the
Hexadecimal – a number system based on the value 16 same as ASCII code).
(uses the denary digits 0 to 9 and the letters A to F).

1.1.1 Number systems


Every one of us is used to the decimal or denary (base 10) number system. This
uses the digits 0 to 9 which are placed in ‘weighted’ columns.
10 000 1000 100 10 units
3 1 4 2 1
The denary number represented above is thirty-one thousand, four hundred and
twenty-one.
(Note that dealing with decimal fractions is covered in Chapter 13 since this is
slightly more complex.)
Designers of computer systems adopted the binary (base 2) number system
since this allows only two values, 0 and 1. No matter how complex the system,
the basic building block in all computers is the binary number system. Since
computers contain millions and millions of tiny ‘switches’, which must be in the
ON or OFF position, this lends itself logically to the binary system. A switch in
the ON position can be represented by 1; a switch in the OFF position can be
represented by 0. Each of the binary digits are known as bits.

1.1.2 Binary number system


The binary system uses 1s and 0s only which gives these corresponding weightings:
128 64 32 16 8 4 2 1
(27) (26) (25) (24) (23) (22) (21) (20)

A typical binary number would be:


1 1 1 0 1 1 1 0
Converting from binary to denary and from denary to binary
It is fairly straightforward to change a binary number into a denary number.
Each time a 1 appears in a column, the column value is added to the total. For
example, the binary number above is:
128 + 64 + 32 + 8 + 4 + 2 = 238 (denary)
2

457591_01_CI_AS & A_Level_CS_001-[Link] 2 25/04/19 9:11 AM


The 0 values are simply ignored when calculating the total.
ACTIVITY 1A
Convert these
The reverse operation – converting from denary to binary – is slightly more
complex. There are two basic ways of doing this. 1
binary numbers into Consider the conversion of the denary number, 107, into binary …
denary.
a) 0 0 1 1 0 0 1 1 Method 1
b) 0 1 1 1 1 1 1 1 This method involves placing 1s in the appropriate position so that the total
c) 1 0 0 1 1 0 0 1 equates to 107.

1.1
d) 0 1 1 1 0 1 0 0 128 64 32 16 8 4 2 1
e) 1 1 1 1 1 1 1 1

Data representation
0 1 1 0 1 0 1 1
f) 0 0 0 0 1 1 1 1
g) 1 0 0 0 1 1 1 1 Method 2
h) 0 0 1 1 0 0 1 1 This method involves successive division by 2; the remainders are then written
i) 0 1 1 1 0 0 0 0 from bottom to top to give the binary value.
j) 1 1 1 0 1 1 1 0 2 107
2 53 remainder: 1
ACTIVITY 1B 2 26 remainder: 1
Write the remainder from
2 13 remainder: 0
Convert these bottom to top to get the
2 6 remainder: 1
denary numbers into binary number:
2 3 remainder: 0 01101011
binary (using either
method). 2 1 remainder: 1
a) 4 1 2 0 remainder: 1
b) 6 7 0 remainder: 0
c) 8 6
Binary addition and subtraction
d) 1 0 0
e) 1 1 1
Up until now we have assumed all binary numbers have positive values. There are a
number of methods to represent both positive and negative numbers. We will consider:
f) 1 2 7
g) 1 4 4 » one’s complement
» two’s complement.
h) 1 8 9
i) 2 0 0 In one’s complement, each digit in the binary number is inverted (in other
j) 2 5 5 words, 0 becomes 1 and 1 becomes 0). For example, 0 1 0 1 1 0 1 0 (denary
value 90) becomes 1 0 1 0 0 1 0 1 (denary value −90).
In two’s complement, each digit in the binary number is inverted and a ‘1’ is
added to the right-most bit. For example, 0 1 0 1 1 0 1 0 (denary value 90)
becomes:
1 0 1 0 0 1 0 1
+ 1
= 1 0 1 0 0 1 1 0 (since 1 + 1 = 0, a carry of 1) = denary value −90

Throughout the remainder of this chapter, we will use the two’s complement
method to avoid confusion. Also, two’s complement makes binary addition
and subtraction more straightforward. The reader is left to investigate one’s
complement and the sign and magnitude method in binary arithmetic.
Now that we are introducing negative numbers, we need a way to represent
these in binary. The two’s complement uses these weightings for an 8-bit
number representation:
−128 64 32 16 8 4 2 1
3

457591_01_CI_AS & A_Level_CS_001-[Link] 3 25/04/19 9:11 AM


This means:
EXTENSION
1 ACTIVITY 1A −128
1
64
1
32
0
16
1
8
1
4
0
2
1
1
0
Show the column 0 0 1 0 0 1 1 0
headings for a
system that uses The first example is: −128 + 64 + 16 + 8 + 2 = −38
16 bits to represent
a binary number. The second example is: 32 + 4 + 2 = 38
1 Information representation and multimedia

The easiest way to convert a number into its negative equivalent is to use two’s
complement. For example, 104 in binary is 0 1 1 0 1 0 0 0.
To find the binary value for −104 using two’s complement:
invert the digits: 1 0 0 1 0 1 1 1 (+104 in denary)
add 1: 1
which gives: 1 0 0 1 1 0 0 0 = −104)

ACTIVITY 1C
Convert these denary numbers into 8-bit binary numbers using two’s
complement where necessary. Use these binary column weightings:

−128 64 32 16 8 4 2 1
a) +114
b) +61
c) +96
d) −14
e) −116

Binary addition
Consider Examples 1.1 and 1.2.

Example 1.1 Add 0 0 1 0 0 1 0 1 (37 in denary) and 0 0 1 1 1 0 1 0 (58 in denary).

Solution
−128 64 32 16 8 4 2 1
0 0 1 0 0 1 0 1
+
0 0 1 1 1 0 1 0
=
0 1 0 1 1 1 1 1

This gives us 0 1 0 1 1 1 1 1, which is 95 in denary; the correct answer.

457591_01_CI_AS & A_Level_CS_001-[Link] 4 25/04/19 9:11 AM


Example 1.2 Add 0 1 0 1 0 0 1 0 (82 in denary) and 0 1 0 0 0 1 0 1 (69 in denary).

Solution
1
−128 64 32 16 8 4 2 1
0 1 0 1 0 0 1 0
+
0 1 0 0 0 1 0 1

1.1
=

Data representation
1 0 0 1 0 1 1 1

This gives us 1 0 0 1 0 1 1 1, which is –105 in denary (which is clearly nonsense).


When adding two positive numbers, the result should always be positive
(likewise, when adding two negative numbers, the result should always be
negative). Here, the addition of two positive numbers has resulted in a negative
answer. This is due to the result of the addition producing a number which is
outside the range of values which can be represented by the 8 bits being used (in
this case +127 is the largest value which can be represented, and the calculation
produces the value 151, which is larger than 127 and, therefore, out of range).
This causes overf low; it is considered in more detail in Chapter 13.

Binary subtraction
To carry out subtraction in binary, we convert the number being subtracted into
its negative equivalent using two’s complement, and then add the two numbers.

Example 1.3 Carry out the subtraction 95 – 68 in binary.

Solution
1 Convert the two numbers into binary:
95 = 0 1 0 1 1 1 1 1
68 = 0 1 0 0 0 1 0 0
2 Find the two’s complement of 68:

invert the digits: 1 0 1 1 1 0 1 1


add 1: 1
which gives: 1 0 1 1 1 1 0 0 = −68
3 Add 95 and −68:

−128 64 32 16 8 4 2 1
0 1 0 1 1 1 1 1
+
1 0 1 1 1 1 0 0
=
1 0 0 0 1 1 0 1 1
The additional ninth bit is simply ignored leaving the binary number
0 0 0 1 1 0 1 1 (denary equivalent of 27, which is the correct result of the
subtraction).

457591_01_CI_AS & A_Level_CS_001-[Link] 5 25/04/19 9:11 AM


Example 1.4 Carry out the subtraction 49 – 80 in binary.
1 Solution
1 Convert the two numbers into binary:
49 = 0 0 1 1 0 0 0 1
80 = 0 1 0 1 0 0 0 0
2 Find the two’s complement of 80:
1 Information representation and multimedia

invert the digits: 1 0 1 0 1 1 1 1


add 1: 1
which gives: 1 0 1 1 0 0 0 0 = −80
3 Add 49 and −80:

−128 64 32 16 8 4 2 1
0 0 1 1 0 0 0 1
+
1 0 1 1 0 0 0 0
=
1 1 1 0 0 0 0 1
This gives us 1 1 1 0 0 0 0 1, which is −31 in denary; the correct answer.

ACTIVITY 1D
Carry out these binary additions and subtractions using these 8-bit column
weightings:

−128 64 32 16 8 4 2 1
a) 00111001+00101001
b) 01001011+00100011
c) 01011000+00101000
d) 01110011+00111110
e) 00001111+00011100
f) 01100011−00110000
g) 01111111−01011010
h) 00110100−01000100
i) 00000011−01100100
j) 11011111−11000011

Measurement of the size of computer memories


The byte is the smallest unit of memory in a computer. Some computers use
larger bytes, such as 16-bit systems and 32-bit systems, but they are always
multiples of 8. 1 byte of memory wouldn’t allow you to store very much
information; so memory size is measured in these multiples. See Table 1.1.

457591_01_CI_AS & A_Level_CS_001-[Link] 6 25/04/19 9:11 AM


Name of memory size Equivalent denary value (bytes)
1 kilobyte (1 KB)
1 megabyte (1 MB)
1 000
1 000 000 1
1 gigabyte (1 GB) 1 000 000 000
1 terabyte (1 TB) 1 000 000 000 000
1 petabyte (1 PB) 1 000 000 000 000 000
▲ Table 1.1 Memory size and denary values

1.1
The system of numbering shown in Table 1.1 only refers to some storage
devices, but is technically inaccurate. It is based on the SI (base 10) system

Data representation
of units where 1 kilo is equal to 1000. A 1 TB hard disk drive would allow the
storage of 1 × 1012 bytes according to this system. However, since memory size
is actually measured in terms of powers of 2, another system has been proposed
by the International Electrotechnical Commission (IEC); it is based on the
binary system. See Table 1.2.
Name of memory size Number of bytes Equivalent denary value (bytes)
1 kibibyte (1 KiB) 210 1 024
1 mebibyte (1 MiB) 220 1 048 576
1 gibibyte (1 GiB) 230 1 073 741 824
1 tebibyte (1 TiB) 240 1 099 511 627 776
1 pebibyte (1 PiB) 250 1 125 899 906 842 624
▲ Table 1.2 IEC memory size system

This system is more accurate. Internal memories (such as RAM) should


be measured using the IEC system. A 64 GiB RAM could, therefore, store
64 × 230 bytes of data (68 719 476 736 bytes).
See Section 1.2 for examples of how to calculate the size of a file.

1.1.3 Hexadecimal number system


The hexadecimal system is very closely related to the binary system.
Hexadecimal (sometimes referred to as simply hex) is a base 16 system with the
weightings:
1 048 576 65 536 4096 256 16 1
(165) (164) (163) (162) (161) (160)

Because it is a system based on 16 different digits, the numbers 0 to 9 and the


letters A to F are used to represent hexadecimal digits.
A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15.
Since 16 = 24, four binary digits are equivalent to each hexadecimal digit. Table
1.3 summarises the link between binary, hexadecimal and denary.

457591_01_CI_AS & A_Level_CS_001-[Link] 7 25/04/19 9:11 AM


Binary value Hexadecimal value Denary value

1 0000
0001
0
1
0
1
0010 2 2
0011 3 3
0100 4 4
0101 5 5
0110 6 6
1 Information representation and multimedia

0111 7 7
1000 8 8
1001 9 9
1010 A 10
1011 B 11
1100 C 12
1101 D 13
1110 E 14
1111 F 15
▲ Table 1.3 The link between binary, hexadecimal and denary

Converting from binary to hexadecimal and from hexadecimal to binary


Converting from binary to hexadecimal is a fairly easy process. Starting from
the right and moving left, split the binary number into groups of 4 bits. If the
last group has less than 4 bits, then simply fill in with 0s from the left. Take
each group of 4 bits and convert it into the equivalent hexadecimal digit using
Table 1.3.
Examples 1.5 and 1.6 show you how this works.
Example 1.5 Convert 1 0 1 1 1 1 1 0 0 0 0 1 from binary to hexadecimal.

Solution
First split it into groups of 4 bits:
1011 1110 0001
Then find the equivalent hexadecimal digits:
B E 1

Example 1.6 Convert 1 0 0 0 0 1 1 1 1 1 1 1 0 1 from binary to hexadecimal.

Solution
First split it into groups of 4 bits:
10 0001 1111 1101
The left group only contains 2 bits, so add in two 0s to the left:
0010 0001 1111 1101
Now find the equivalent hexadecimal digits:
2 1 F D

457591_01_CI_AS & A_Level_CS_001-[Link] 8 25/04/19 9:11 AM


ACTIVITY 1E
Convert these binary numbers into hexadecimal. 1
a) 1 1 0 0 0 0 1 1 f) 1 0 0 0 1 0 0 1 1 1 1 0
b) 1 1 1 1 0 1 1 1 g) 0 0 1 0 0 1 1 1 1 1 1 1 0
c) 1 0 0 1 1 1 1 1 1 1 h) 0 1 1 1 0 1 0 0 1 1 1 0 0
d) 1 0 0 1 1 1 0 1 1 1 0 i) 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1
e) 0 0 0 1 1 1 1 0 0 0 0 1 j) 0 0 1 1 0 0 1 1 1 1 0 1 0 1 1 1 0

1.1
Data representation
Converting from hexadecimal to binary is also straightforward. Using the data
from Table 1.3, simply take each hexadecimal digit and write down the 4 bit
code which corresponds to the digit.

Example 1.7 Convert this hexadecimal number to its binary equivalent.


4 5 A

Solution
Using Table 1.3, find the 4-bit code for each digit:
0 1 0 0   0 1 0 1   1 0 1 0
Put the groups together to form the binary number:
010001011010

Example 1.8 Convert this hexadecimal number to its binary equivalent.


B F 0 8

Solution
Using Table 1.3:
1 0 1 1   1 1 1 1   0 0 0 0   1 0 0 0
Then put all the digits together:
1011111100001000

Use of the hexadecimal system


This section reviews two uses of the hexadecimal system.
Memory dumps
It is much easier to work with:
B5A41AFC
than it is to work with:
10110101101001000001101011111100
So, hexadecimal is often used when developing new software or when trying to
trace errors in programs. When the memory contents are output to a printer or
monitor, this is known as a memory dump.
9

457591_01_CI_AS & A_Level_CS_001-[Link] 9 25/04/19 9:11 AM


Now we will add .3 and .9 together (the two digits in the first decimal place)

1
remembering the carry bit from the addition above:

0 0 1 1
+
1 0 0 1
1 Information representation and multimedia

+
1
=
1 1 0 1

This produces 1 1 0 1 which isn’t a denary digit; this will flag an error and the
computer again needs to add 0 1 1 0.

1 1 0 1
This again produces +
a fifth bit which is 0 1 1 0
carried to the next =
decimal digit position. 1 0 0 1 1

ACTIVITY 1H
Adding 1 to 0 0 0 0 0 0 0 0 produces:
Carry out these BCD
0 0 0 0 0 0 0 1
additions.
a) 0.45 + 0.21 Final answer:
b) 0.66 + 0.51
c) 0.88 + 0.75 0 0 0 0 0 0 0 1 . 0 0 1 1 0 0 0 1

which is 1.31 in denary – the correct answer.

1.1.5 ASCII codes and Unicodes


The ASCII code system (American Standard Code for Information Interchange)
was set up in 1963 for use in communication systems and computer systems.
The newer version of the code was published in 1986. The standard ASCII
code character set consists of 7-bit codes (0 to 127 denary or 0 to 7F in
hexadecimal); this represents the letters, numbers and characters found on a
standard keyboard together with 32 control codes (which use up codes 0 to 31
(denary) or 0 to 19 (hexadecimal)).
Table 1.5 shows part of the standard ASCII code table (only the control codes
have been removed from the table).

12

457591_01_CI_AS & A_Level_CS_001-[Link] 12 25/04/19 9:11 AM


Dec Hex Char Dec Hex Char Dec Hex Char
32
33
20
21
<SPACE>
!
64
65
40
41
@
A
96
97
60
61
`
a 1
34 22 “ 66 42 B 98 62 b
35 23 # 67 43 C 99 63 c
36 24 $ 68 44 D 100 64 d
37 25 % 69 45 E 101 65 e
38 26 & 70 46 F 102 66 f

1.1
39 27 ‘ 71 47 G 103 67 g

Data representation
40 28 ( 72 48 H 104 68 h
41 29 ) 73 49 I 105 69 i
42 2A * 74 4A J 106 6A j
43 2B + 75 4B K 107 6B k
44 2C , 76 4C L 108 6C l
45 2D - 77 4D M 109 6D m
46 2E . 78 4E N 110 6E n
47 2F / 79 4F O 111 6F o
48 30 0 80 50 P 112 70 p
49 31 1 81 51 Q 113 71 q
50 32 2 82 52 R 114 72 r
51 33 3 83 53 S 115 73 s
52 34 4 84 54 T 116 74 t
53 35 5 85 55 U 117 75 u
54 36 6 86 56 V 118 76 v
55 37 7 87 57 W 119 77 w
56 38 8 88 58 X 120 78 x
57 39 9 89 59 Y 121 79 y
58 3A : 90 5A Z 122 7A z
59 3B ; 91 5B [ 123 7B {
60 3C < 92 5C \ 124 7C |
61 3D = 93 5D ] 125 7D }
62 3E > 94 5E ^ 126 7E ~
63 3F ? 95 5F _ 127 7F <DELETE>
▲ Table 1.5 Part of the ASCII code table

Notice the storage of characters with uppercase and lowercase. For example:
a 1 1 0 0 0 0 1 hex 61 (lower case)
A 1 0 0 0 0 0 1 hex 41 (upper case)
y 1 1 1 1 0 0 1 hex 79 (lower case)
Y 1 0 1 1 0 0 1 hex 59 (uppercase)
Notice the sixth bit changes from 1 to 0 when comparing lower and uppercase
characters. This makes the conversion between the two an easy operation. It
is also noticeable that the character sets (such as a to z, 0 to 9, and so on) are
grouped together in sequence, which speeds up usability.
Extended ASCII uses 8-bit codes (128 to 255 in denary or 80 to FF in hex). This
allows for non-English characters and for drawing characters to be included.
13

457591_01_CI_AS & A_Level_CS_001-[Link] 13 25/04/19 9:11 AM


Dec Hex Char Dec Hex Char Dec Hex Char Dec Hex Char Dec Hex Char

1
128 80 Ç 154 9A Ü 180 B4 ┤ 206 CE ╬ 232 E8 Φ
129 81 ü 155 9B ḉ 181 B5 ╡ 207 CF ╧ 233 E9 Θ
130 82 é 156 9C £ 182 B6 ╢ 208 D0 ╨ 234 EA Ω
131 83 â 157 9D ¥ 183 B7 ╖ 209 D1 ╤ 235 EB δ
132 84 ä 158 9E ₧ 184 B8 ╕ 210 D2 ╥ 236 EC ∞
133 85 à 159 9F ƒ 185 B9 ╣ 211 D3 ╙ 237 ED ø
134 86 å 160 A0 á 186 BA ║ 212 D4 ╘ 238 EE ε
135 87 ç 161 A1 í 187 BB ╗ 213 D5 ╒ 239 EF ∩
1 Information representation and multimedia

136 88 ê 162 A2 ó 188 BC ╝ 214 D6 ╓ 240 F0 ≡


137 89 ë 163 A3 ú 189 BD ╜ 215 D7 ╫ 241 F1 ±
138 8A è 164 A4 ñ 190 BE ╛ 216 D8 ╪ 242 F2 ≥
139 8B ï 165 A5 Ñ 191 BF ┐ 217 D9 243 F3 ≤

140 8C î 166 A6 ᵃ 192 C0 └ 218 DA ┌ 244 F4 ⌠
141 8D ì 167 A7 ᵒ 193 C1 ┴ 219 DB █ 245 F5 ⌡
142 8E Ä 168 A8 ¿ 194 C2 ┬ 220 DC ▄ 246 F6 ÷
143 8F Å 169 A9 ⌐ 195 C3 ├ 221 DD ▌ 247 F7 ≈
144 90 É 170 AA ¬ 196 C4 ─ 222 DE ▐ 248 F8 °
145 91 æ 171 AB ½ 197 C5 ┼ 223 DF ▀ 249 F9 ▪▪
146 92 Æ 172 AC ¼ 198 C6 ╞ 224 E0 α 250 FA ▪
147 93 ô 173 AD ¡ 199 C7 ╟ 225 E1 ß 251 FB √
148 94 ö 174 AE « 200 C8 ╚ 226 E2 Г 252 FC ³
149 95 ò 175 AF » 201 C9 ╔ 227 E3 п 253 FD ²
150 96 û 176 B0 ░ 202 CA ╩ 228 E4 ∑ 254 FE ■
151 97 ù 177 B1 ▒ 203 CB ╦ 229 E5 σ 255 FF □
152 98 ӱ 178 B2 ▓ 204 CC ╠ 230 E6 μ
153 99 Ö 179 B3 │ 205 CD ═ 231 E7 τ
▲ Table 1.6 Extended ASCII code table

Since ASCII code has a number of disadvantages and is unsuitable for some
purposes, different methods of coding have been developed over the years.
One coding system is called Unicode. Unicode allows characters in a code
form to represent all languages of the world, thus supporting many operating
systems, search engines and internet browsers used globally. There is overlap
with standard ASCII code, since the first 128 (English) characters are the same,
but Unicode can support several thousand different characters in total. As can
be seen in Tables 1.5 and 1.6, ASCII uses one byte to represent a character,
whereas Unicode will support up to four bytes per character.
The Unicode consortium was set up in 1991. Version 1.0 was published with five
goals, these were to
» create a universal standard that covered all languages and all writing systems
» produce a more efficient coding system than ASCII
» adopt uniform encoding where each character is encoded as 16-bit or 32-bit code
» create unambiguous encoding where each 16-bit or 32-bit value always
represents the same character (it is worth pointing out here that the ASCII
code tables are not standardised and versions other than the ones shown in
tables 1.5 and 1.6 exist)
» reserve part of the code for private use to enable a user to assign codes for their
own characters and symbols (useful for Chinese and Japanese character sets).
A sample of Unicode characters are shown in Table 1.7. As can be seen from
the table, characters used in languages such as Russian, Greek, Romanian and
Croatian can now be represented in a computer).
14

457591_01_CI_AS & A_Level_CS_001-[Link] 14 25/04/19 9:11 AM


0 1 2 3 4 5 6 7 8 9 A B C D E F
01A0 Ơ
01B0 ư
ơ
Ʊ
Ƣ
Ʋ
ƣ
Ƴ
Ƥ
ƴ
ƥ
Ƶ
Ʀ
ƶ
Ƨ
Ʒ
ƨ
Ƹ
Ʃ
ƹ
ƪ
ƺ
ƫ
ƻ
Ƭ
Ƽ
ƭ
ƽ
Ʈ
ƾ
Ư
ƿ 1
01C0 ǀ ǁ ǂ ǃ DŽ Dž dž LJ Lj lj NJ Nj nj Ǎ ǎ Ǐ
01D0 ǐ Ǒ ǒ Ǔ ǔ Ǖ ǖ Ǘ ǘ Ǚ ǚ Ǜ ǜ ǝ Ǟ ǟ
01E0 Ǡ ǡ Ǣ ǣ Ǥ ǥ Ǧ ǧ Ǩ ǩ Ǫ ǫ Ǭ ǭ Ǯ ǯ
01F0 ǰ DZ Dz dz Ǵ ǵ Ƕ Ƿ Ǹ ǹ Ǻ ǻ Ǽ ǽ Ǿ ǿ
0200 Ȁ ȁ Ȃ ȃ Ȅ ȅ Ȇ ȇ Ȉ ȉ Ȋ ȋ Ȍ ȍ Ȏ ȏ

1.2
0210 Ȑ ȑ Ȓ ȓ Ȕ ȕ Ȗ ȗ Ș ș Ț ț Ȝ ȝ Ȟ ȟ

Multimedia
0220 Ƞ ȡ Ȣ ȣ Ȥ ȥ Ȧ ȧ Ȩ ȩ Ȫ ȫ Ȭ ȭ Ȯ ȯ
0230 Ȱ ȱ Ȳ ȳ ȴ ȵ ȶ ȷ ȸ ȹ Ⱥ Ȼ ȼ Ƚ Ⱦ ȿ
0240 ɀ Ɂ ɂ Ƀ Ʉ Ʌ Ɇ ɇ Ɉ ɉ Ɋ ɋ Ɍ ɍ Ɏ ɏ
0250 ɐ ɑ ɒ ɓ ɔ ɕ ɖ ɗ ɘ ǝ ɚ ɛ ɜ ɝ ɞ ɟ
0260 ɠ ɡ ɢ ɣ ɤ ɥ ɦ ɧ ɨ ɩ ɪ ɫ ɬ ɭ ɮ ɯ
0270 ɰ ɱ ɲ ɳ ɴ ɵ ɶ ɷ ɸ ɹ ɺ ɻ ɼ ɽ ɾ ɿ
0280 ʀ ʁ ʂ ʃ ʄ ʅ ʆ ʇ ʈ ʉ ʊ ʋ ʌ ʍ ʎ ʏ
0290 ʐ ʑ ʒ ʓ ʔ ʕ ʖ ʗ ʘ ʙ ʚ ʛ ʜ ʝ ʞ ʟ
02A0 ʠ ʡ ʢ ʣ ʤ ʥ ʦ ʧ ʨ ʩ ʪ ʫ ʬ ʭ ʮ ʯ
02B0 ʰ ʱ ʲ ʳ ʴ ʵ ʶ ʷ ʸ ʹ ʺ ʻ ʼ ʽ ʾ ʿ

▲ Table 1.7 Sample of Unicode characters

1.2 Multimedia
Key terms
Bit-map image – system that uses pixels to make up an resolution is smaller than the image resolution, the
image. whole image cannot be shown on the screen, or the
Pixel – smallest picture element that makes up an image. original image will become lower quality.
Colour depth – number of bits used to represent the Resolution – number of pixels per column and per row
colours in a pixel, e.g. 8 bit colour depth can represent on a monitor or television screen.
28 = 256 colours. Pixel density – number of pixels per square centimetre.
Bit depth – number of bits used to represent the Vector graphics – images that use 2D points to describe
smallest unit in, for example, a sound or image file – lines and curves and their properties that are grouped to
the larger the bit depth, the better the quality of the form geometric shapes.
sound or colour image. Sampling resolution – number of bits used to represent
Image resolution – number of pixels that make up an sound amplitude (also known as bit depth).
image, for example, an image could contain 4096 × 3192 Sampling rate – number of sound samples taken per
pixels (12 738 656 pixels in total). second.
Screen resolution – number of horizontal and vertical Frame rate – number of video frames that make up a
pixels that make up a screen display. If the screen video per second.

Images can be stored in a computer in two common formats: bit-map image and
vector graphic.

1.2.1 Bit-map images


Bit-map images are made up of pixels (picture elements); the image is stored
in a two-dimensional matrix of pixels.
Pixels can take different shapes, such as or
or
or

15

457591_01_CI_AS & A_Level_CS_001-[Link] 15 25/04/19 9:11 AM


When storing images as pixels, we have to consider
EXTENSION
1 ACTIVITY 1B
» at least 8 bits (1 byte) per pixel are needed to code a coloured image (this
gives 256 possible colours by varying the intensity of the blue, green and
red elements)
Find out how HTML
is used to control » true colour requires 3 bytes per pixel (24 bits), which gives more than one
the colour of each million colours
pixel on a screen. » the number of bits used to represent a pixel is called the colour depth.
How is HTML used in In terms of images, we need to distinguish between bit depth and colour
the design stage of depth; for example, the number of bits that are used to represent a single
1 Information representation and multimedia

a web page screen


pixel (bit depth) will determine the colour depth of that pixel. As the bit
layout?
depth increases, the number of possible colours which can be represented also
increases. For example, a bit depth of 8 bits per pixel allows 256 (28) different
colours (the colour depth) to be represented, whereas using a bit depth of
32 bits per pixel results in 4 294 967 296 (232) different colours. The impact of
bit depth and colour depth is considered later.
We will now consider the actual image itself and how it can be displayed on a
screen. There are two important definitions here:
» Image resolution refers to the number of pixels that make up an image; for
example, an image could contain 4096 × 3192 pixels (12 738 656 pixels in
total).
» Screen resolution refers to the number of horizontal pixels and the number
of vertical pixels that make up a screen display (for example, if the screen
resolution is smaller than the image resolution then the whole image cannot
be shown on the screen or the original image will now be a lower quality).

We will try to clarify the difference by using an example.


Figure 1.1 has been taken by a digital camera using an image resolution of
4096 × 3192 pixels:

▲ Figure 1.1 Image taken by a digital camera

Suppose we wish to display Figure 1.1 on a screen with screen resolution of


▲ Figure 1.2 Image cropped 1920 × 1080. To display this image the web browser (or other software) would
and rotated through 90° need to re-size Figure 1.1 so that it now fits the screen. This could be done by
removing pixels so that it could now be displayed, or part of the image could
be cropped (and, in this case, rotated through 90°) as shown in Figure 1.2.
16

457591_01_CI_AS & A_Level_CS_001-[Link] 16 25/04/19 9:11 AM


However, a lower resolution copy of Figure 1.1 (for example, 1024 × 798) would

1
now fit on the screen without any modification to the image. We could simply
zoom in to enlarge it to full screen size; however, the image could now become
pixelated (in other words, the number of pixels per square inch (known as the
pixel density) is smaller, causing deterioration in the image quality).
We will now consider a calculation which shows how pixel density can be
calculated for a given screen. Imagine we are using an Apple iPhone 8 which
has 5.5-inch screen size and screen resolution of 1920 pixels × 1080 pixels:
1 add together the squares of the resolution size ((19202 + 10802) = (3 686 400

1.2
+ 16 640) = 4 852 800)

Multimedia
(
2 find the square root 4852800 = 2202.907 )
3 divide by screen size (2202.907 ÷ 5.5 = 401)
This gives us the pixel density of 401 pixels per square inch (ppi) (which is the
same as the published figure from the manufacturer).
A pixel-generated image can be scaled up or scaled down; it is important
to understand that this can be done when deciding on the resolution. The
resolution can be varied on many cameras before taking, for example, a digital
photograph. When magnifying an image, the number of pixels that makes up
the image remains the same but the area they cover is now increased. This
means some of the sharpness could be lost. This is known as the pixel density
and is key when scaling up photographs. For example, look at Figure 1.3.

A B C D E
▲ Figure 1.3 Five images of the same car wheel

Image A is the original. By the time it has been scaled up to make image E it
has become pixelated (‘fuzzy’). This is because images A and E have different
pixel densities.
The main drawback of using high resolution images is the increase in file size. As
the number of pixels used to represent the image is increased, the size of the file
will also increase. This impacts on how many images can be stored on, for example,
a hard drive. It also impacts on the time to download an image from the internet or
the time to transfer images from device to device. Bit-map images rely on certain
properties of the human eye and, up to a point, the amount of file compression
used (see Section 1.3 File compression). The eye can tolerate a certain amount of
resolution reduction before the loss of quality becomes significant.

Calculating bit-map image file sizes


EXTENSION It is possible to estimate the file size needed to store a bit-map image. The file
size will need to take into account the image resolution and bit depth.
ACTIVITY 1C
For example, a full screen with a resolution of 1920 × 1080 pixels and a bit depth
Calculate the file of 24 requires 1920 × 1080 × 24 bits = 49 766 400 bits for the full screen image.
size needed to store
the screen image on
Dividing by 8 gives us 6 220 800 bytes (equivalent to 6.222 MB using the SI
a UHD television. units or 5.933 MiB using IEE units). An image which does not occupy the full
screen will obviously result in a smaller file size.
17

457591_01_CI_AS & A_Level_CS_001-[Link] 17 25/04/19 9:11 AM


Note: when saving a bit-map image, it is important to include a file header; this will

1
contain items such as file type (.bmp or .jpeg), file size, image resolution, bit depth
(usually 1, 8, 16, 24 or 32), any type of data compression employed and so on.

1.2.2 Vector graphics


Vector graphics are images that use 2D points to describe lines and curves and
their properties that are grouped to form geometric shapes. Vector graphics
can be designed using computer aided design (CAD) software or using an
application which uses a drawing canvas on the screen. See Figure 1.4.
1 Information representation and multimedia

A vector graphic will contain a drawing list (included in a file header) that is
made up of
» the command used for each object that makes up the graphic image
▲ Figure 1.4 Drawing of a » the attributes that define the properties that make up each object (for
robot made up of a number example consider the ellipse of the robot’s mouth – this will need the
of geometric shapes position of the two centres, the radius from centres, the thickness and style
of each line, the line colour and any fill colour used)
» the relative position of each object will also need to be included
» the dimensions of each object are not defined, but the relative positions of
objects to each other in the final graphic need to be defined; this means
that scaling up the vector graphic image will result in no loss of quality.
When printing out vector graphics it is usually necessary to first convert it into
a bit-map image to match the format of most printers.

Comparison between vector graphics and bit-map images


Vector graphic images Bit-map images
made up of geometric shapes which
made up of tiny pixels of different colours
require definition/attributes
to alter/edit the design, it is necessary possible to alter/edit each of the pixels to
to change each of the geometric shapes change the design of the image
they do not require large file size since because of the use of pixels (which give very
it is made up of simple geometric shapes accurate designs), the file size is very large
because the number of geometric shapes
since images are built up pixel by pixel, the
is limited, vector graphics are not
final image is usually very realistic
usually very realistic
file formats are usually .svg, .cgm, .odg file formats are usually .jpeg, .bmp, .png
▲ Table 1.8 Comparison between vector graphics and bit-map images

It is now worth considering whether a vector graphic or a bit-map image would


be the best choice for a given application. When deciding which is the better
method, we should consider the following:
» Does the image need to be resized? If so, a vector graphic could be the best
option.
» Does the image need to be drawn to scale? Again, a vector graphic is
probably the best option.
» Does the image need to look real? Usually bit-map images look more realistic
than vector graphics.
» Are there file restrictions? If so, it is important to consider whether vector
graphic images can be used; if not, it would be necessary to consider the
image resolution of a bit-map image to ensure the file size is not too large.

18

457591_01_CI_AS & A_Level_CS_001-[Link] 18 25/04/19 9:11 AM

You might also like