Denary to Hexadecimal (Show your steps)
a) 200810 b) 91110
= 7D816 = 38F16
16 2008 16 911
16 125 ……8 16 56 ……15(F)
7 ……13(D) 3 …… 8
Calculator operation
Model: CASIO fx-3650P / fx-50FH
Change to binary number system Change to denary number system
MODE MODE 3 log MODE MODE 3 x2
Example: 1010 + 10
1 0 1 0 EXE + 1 0 EXE
Answer: 1100
Change to hexadecimal number system Change back to general calculation mode
MODE MODE 3 ^ MODE 1
Example: 1A + 10
1 (-) EXE + 1 0 EXE
Answer: 2A
12
Number of combinations
For example, HKID consists of 8 characters in total, a capital English letter, 6 digits and 1 check
digit. Since that the check digit is calculated by the previous characters, therefore, it does not
affect the total number of combinations in HKID and can be ignored.
Check digit does not affect
A 1 2 3 4 5 6 (7) the no. of combination.
No. of combination = 26 × 10 × 10 × 10 × 10 × 10 × 10
= 26000000
Think About It
1. How many different combinations are there in an 8-bit binary number system?
Smallest value: 0000 00002 = 010
Largest value: 1111 11112 = 1 0000 00002 – 12 = 25610 – 110 = 25510
∴ An 8-bit binary number system can represent 256 different numbers.
2. The format of RGB code consists of ‘#’ and 6-digit hexadecimal numbers. For example, white
colour is #FFFFFF and black colour is #000000. How many colours can RGB code represent?
Smallest value: 00000016 = 010
Largest value: FFFFFF16 = 100000016 – 116 = 1677721610 – 110 = 1677721510
∴ RGB can represent up to 16777216 different colours.
Number Representation in Computer System (Book1, p.84-85)
Word length
The data of certain number of
bits that a computer can handle
at a time is called “word”.
16, 32 or 64-bit are common
word length of modern
computers.
13
Two’s complement (Book1, p.86-90)
Method 1
Positive numbers: Find out the 8-bit representation of two’s complement of 410.
Step 1: 8-bit binary representation of 410 = 0000 01002
Negative numbers: Find out the 8-bit representation of two’s complement of -4 10.
Step 1: 8-bit binary representation of 410 = 0000 01002
Step 2: One’s complement of -410 = 1111 10112
Step 3: Two’s complement of -4 10 = 1111 10112 + 12 = 1111 11002
Method 2
-27 26 25 24 23 22 21 20
-128 64 32 16 8 4 2 1
8-bit two’s complement of 410 = 0 0 0 0 0 1 0 0
8-bit two’s complement of -410 = 1 1 1 1 1 1 0 0
Overflow error (Book1, p.91-93)
For a calculation of two integers with fixed digits, an error may occur when the result is outside
the range that the digits can represent.
For example,
The range that 8-bit two’s complement number system can represent:
-27 26 25 24 23 22 21 20
-128 64 32 16 8 4 2 1
Max. value = 0 1 1 1 1 1 1 1 = 12710
Min. value = 1 0 0 0 0 0 0 0 = -12810 A cup overflowing
with water
In 8-bit two’s complement calculation, overflow error (will / will not) occur when 12010 + 1210.
In 8-bit two’s complement calculation, overflow error (will / will not) occur when -2410 - 9610.
14
Character Coding Systems (Book1, p.93-99)
Storage of one Symbols and Traditional Simplified Other
character English letters Chinese Chinese languages
ASCII 8-bit
EBCDIC 8-bit
Big5 16-bit
Guo Biao (GB) 16-bit
UTF-8 8-bit to 32-bit
Unicode UTF-16 16-bit
UTF-32 32-bit
Symbols, numbers and English characters are included in all kinds of character coding
systems.
Mojibake is the garbled text that is the result of text being decoded using an unintended
character encoding.
This problem can be solved by selecting an appropriate character coding system or using a
conversion program to convert the text in the file.
15
Core - Chapter 3 Number and Character Coding Systems (Glossary)
* Extracurricular
English 中文 English 中文
1 Binary 二進制 14 *Zettabyte (ZB) 十萬億億字節
2 Denary 十進制 15 *Yottabyte (YB) 一億億億字節
3 Octal 八進制 16 *Brontobyte (BB) 一千億億億字節
4 Hexadecimal 十六進制 17 Ones’ complement 一補碼 / 反碼
5 Bit (b) 位元 18 Twos’ complement 二補碼
6 Byte (B) 字節 19 Character Coding System 字符編碼系統
7 Word Length 字長 20 *ASCII 美國信息交換標準碼
8 Kilobyte (KB) 千字節 21 *EBCDIC 擴充二/十進制交換代碼
9 Megabyte (MB) 百萬字節 22 Big5 大五碼
10 Gigabyte (GB) 十億字節 23 Guo Biao (GB) 國標碼
11 Terabyte (TB) 萬億字節
12 *Petabyte (PB) 千萬億字節
13 *Exabyte (EB) 百億億字節
16