الأسبوع 4 · الوحدة ١ «النظم العددية» (٤): النظام السداسي عشر، التحويل من السداسي عشر إلى العشري ومن العشري إلى السداسي عشر · 3 دروس
1
Sixteen symbols: meet hexadecimal
ICT Secondary 3 Term 1, Unit 1, Topic 1: pp. 18–21
GoalName the sixteen hexadecimal symbols and their values, and say why hexadecimal is used.
New words
hexadecimal system · the number system with base 16 and the sixteen symbols 0 to 9 and A to Fsymbol value · the number a symbol stands for: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15memory address · a number that says where a piece of data is stored in the computer’s memoryMAC address · the hardware address of a network card, often written in hexadecimal
Explanation
The hexadecimal system has base 16, so it needs sixteen symbols. The first ten are the digits 0 to 9. The other six are the letters A, B, C, D, E and F, with the values A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15. In a hexadecimal number these letters are digits, not parts of a word: in 3E9 the E is a digit worth 14. In this course we write the letters as capitals. The ready functions of PHP and VB.NET print them in lower case (3e9), which is exactly the same number. After F comes 10, which in hexadecimal means one sixteen and no ones. Why use it? It writes long binary numbers short, because one hexadecimal symbol stands for exactly four bits (you will see this next week). So memory addresses, colour codes in some programming languages and the hardware address of a network card are often written in hexadecimal. It is only a way of writing a number: the data stay the same.
Symbol
0
1
2
3
4
5
6
7
Value
0
1
2
3
4
5
6
7
Symbol
8
9
A
B
C
D
E
F
Value
8
9
10
11
12
13
14
15
Worked examples
Hexadecimal
Ordinary count
9
9
A
10
F
15
10
16
Count in hexadecimal: 8, 9, A, B, C, D, E, F, and then 10. The hexadecimal number 10 is one sixteen and no ones, so in ordinary counting it is sixteen.
Text
Hexadecimal number?
Reason
3E9
yes
3, E and 9 are allowed
1G7
no
G is not one of the sixteen symbols
B00
yes
B and 0 are allowed
9K
no
K is not one of the sixteen symbols
850
yes
all three are digits
Which texts are hexadecimal numbers? A text is one when every character is one of the sixteen symbols, even when it looks like an ordinary number.
Class activity
On paper, write the sixteen symbols in a row with their values. Make up three strings of three characters, two that are hexadecimal numbers and one that uses a letter that is not allowed, and ask a friend to find the odd one.
Practice
1
What value does the symbol D have?
13.
2
What does 10 mean in hexadecimal?
One sixteen and no ones, that is sixteen in ordinary counting.
3
Is BAD a hexadecimal number? Is HEX?
Yes, BAD is: B, A and D are among the sixteen symbols. HEX is not: H and X are not among the sixteen symbols.
4
A program prints 3e9. Is it a different number from 3E9?
No. Only the letter case differs; the value is the same.
5
Why is hexadecimal used for long binary numbers?
It is much shorter, because one hexadecimal symbol stands for four bits.