这是用户在 2024-9-19 22:44 为 https://app.immersivetranslate.com/pdf-pro/f8ccf969-e1eb-4de2-bb75-77db8a52b41c 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?

Activity 1.5  活动 1.5

Convert the following hexadecimal numbers into denary:
将下列十六进制数转换为二进制数:

a 6 B
f A 01
b 9 C
g B B BB B 4
g B B BB B 4

c 4 A
h C C CC A 8
h C C CC A 8

d F F
i 12 A E
e 1 F F
j A D 89
To convert from denary to hexadecimal involves successive division by 16 until the value " 0 " is reached. This is best shown by two examples:
要从二进制转换为十六进制,需要连续除以 16,直到取值为 "0"。两个例子最能说明这一点:

? ? ?? Example 1  ? ? ?? 示例 1

Convert the denary number, 2004, into hexadecimal.
将二进制数 2004 转换为十六进制数。

This method involves successive division by 16 until the value 0 is reached. We start by dividing the number 2004 by 16 . The result of the division including the remainder (even if it is 0 ) is written under 2004 and then further divisions by 16 are carried out (that is, 2004 ÷ 16 = 125 2004 ÷ 16 = 125 2004-:16=1252004 \div 16=125 remainder 4 ; 125 ÷ 16 = 7 4 ; 125 ÷ 16 = 7 4;125-:16=74 ; 125 \div 16=7 remainder 13 ; 7 ÷ 16 = 0 13 ; 7 ÷ 16 = 0 13;7-:16=013 ; 7 \div 16=0 remainder 7 ). The hexadecimal number is obtained from the remainders written in reverse order:
这种方法是连续除以 16,直到数值为 0。我们先用数字 2004 除以 16。包括余数在内的除法结果(即使是 0)写在 2004 下面,然后再除以 16(即 2004 ÷ 16 = 125 2004 ÷ 16 = 125 2004-:16=1252004 \div 16=125 余数 4 ; 125 ÷ 16 = 7 4 ; 125 ÷ 16 = 7 4;125-:16=74 ; 125 \div 16=7 余数 13 ; 7 ÷ 16 = 0 13 ; 7 ÷ 16 = 0 13;7-:16=013 ; 7 \div 16=0 余数 7)。十六进制数由按相反顺序写入的余数得出:
Figure 1.2a 图 1.2a

2 Example 2 2 示例 2

Convert the denary number, 8463 , into hexadecimal.
将二进制数 8463 转换为十六进制数。

We start by dividing the number 8463 by 16 . The result of the division including the remainder (even if it is 0 ) is written under 8463 and then further divisions by 16 are carried out (that is, 8463 ÷ 16 = 528 8463 ÷ 16 = 528 8463-:16=5288463 \div 16=528 remainder 15; 528 ÷ 16 = 33 528 ÷ 16 = 33 528-:16=33528 \div 16=33 remainder 0 ; 33 ÷ 16 = 2 0 ; 33 ÷ 16 = 2 0;33-:16=20 ; 33 \div 16=2 remainder 1 ; 2 ÷ 16 = 0 1 ; 2 ÷ 16 = 0 1;2-:16=01 ; 2 \div 16=0 remainder 2 ). The hexadecimal number is obtained from the remainders written in reverse order:
我们先用 8463 除以 16。包括余数(即使是 0)在内的除法结果写在 8463 下面,然后再除以 16(即 8463 ÷ 16 = 528 8463 ÷ 16 = 528 8463-:16=5288463 \div 16=528 余数 15; 528 ÷ 16 = 33 528 ÷ 16 = 33 528-:16=33528 \div 16=33 余数 0 ; 33 ÷ 16 = 2 0 ; 33 ÷ 16 = 2 0;33-:16=20 ; 33 \div 16=2 余数 1 ; 2 ÷ 16 = 0 1 ; 2 ÷ 16 = 0 1;2-:16=01 ; 2 \div 16=0 余数 2)。十六进制数由按相反顺序写入的余数得出:
16 8463 Δ Δ Delta\Delta

从下至上读取余数,得到十六进制数:2
read the remainder from bottom to top
to get the hexadecimal number:
2 1 0 F F FF ( F = 15 ) ( F = 15 ) (F=15)(F=15)
2 1 0 F (F=15)| 2 | 1 | 0 | $F$ | $(F=15)$ | | :--- | :--- | :--- | :--- | :--- |
read the remainder from bottom to top to get the hexadecimal number: 2,1,0,F,(F=15)| read the remainder from bottom to top | | :--- | | to get the hexadecimal number: | | 2 1 0 $F$ $(F=15)$ |
16 528 remainder: 其余部分 15
16 33 remainder: 其余部分 0
16 2 remainder: 其余部分 1
0 remainder: 其余部分 2
16 8463 Delta "read the remainder from bottom to top to get the hexadecimal number: 2,1,0,F,(F=15)" 16 528 remainder: 15 16 33 remainder: 0 16 2 remainder: 1 0 remainder: 2 | 16 | 8463 | | | $\Delta$ | read the remainder from bottom to top <br> to get the hexadecimal number: <br> 2 1 0 $F$ $(F=15)$ | | :---: | :---: | :---: | :---: | :---: | :---: | | 16 | 528 | remainder: | 15 | | | | 16 | 33 | remainder: | 0 | | | | 16 | 2 | remainder: | 1 | | | | | 0 | remainder: | 2 | | |
Figure 1.2b 图 1.2b

Activity 1.6 活动 1.6

Convert the following denary numbers into hexadecimal:
将下列二进制数转换为十六进制数:
a 9 8 f 1 0 0 0
b 2 2 7 g 2 6 3 4
c 4 9 0 h 3 7 4 3
d 5 1 1 i 4 0 0 7
e 8 2 6 j 5 0 0 0
a 9 8 f 1 0 0 0 b 2 2 7 g 2 6 3 4 c 4 9 0 h 3 7 4 3 d 5 1 1 i 4 0 0 7 e 8 2 6 j 5 0 0 0| a | 9 | 8 | f | 1 | 0 | 0 | 0 | | | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | | b | 2 | 2 | 7 | g | 2 | 6 | 3 | 4 | | c | 4 | 9 | 0 | h | 3 | 7 | 4 | 3 | | d | 5 | 1 | 1 | i | 4 | 0 | 0 | 7 | | e | 8 | 2 | 6 | j | 5 | 0 | 0 | 0 |

1.1.3 Use of the hexadecimal system
1.1.3 十六进制系统的使用

As we have seen, a computer can only work with binary data. Whilst computer scientists can work with binary, they find hexadecimal to be more convenient to use. This is because one hex digit represents four binary digits. A complex binary number, such as 1101001010101111 can be written in hex as D2AF. The hex number is far easier for humans to remember, copy and work with. This section reviews four uses of the hexadecimal system:
正如我们所见,计算机只能处理二进制数据。虽然计算机科学家可以处理二进制数据,但他们认为使用十六进制更为方便。这是因为一个十六进制数代表四个二进制数。一个复杂的二进制数,如 11010010101111,可以用十六进制写成 D2AF。对于人类来说,十六进制数更容易记忆、复制和使用。本节将介绍十六进制系统的四种用途:

》 error codes 错误代码
》 MAC addresses MAC地址
» IPv6 addresses "IPv6 地址
»HTML colour codes "HTML 颜色代码
The information in this section gives the reader sufficient grounding in each topic at this level. Further material can be found by searching the internet, but be careful that you don’t go off at a tangent.
本节中的信息为读者提供了本级别每个主题的足够基础。更多资料可在互联网上搜索,但要注意不要跑题。

Error codes 错误代码

Error codes are often shown as hexadecimal values. These numbers refer to the memory location of the error and are usually automatically generated by the computer. The programmer needs to know how to interpret the hexadecimal error codes. Examples of error codes from a Windows system are shown below:
错误代码通常显示为十六进制值。这些数字指的是发生错误的内存位置,通常由计算机自动生成。程序员需要知道如何解释十六进制错误代码。Windows 系统的错误代码示例如下:
Find out more 了解更多
Another method used to trace errors during program development is to use memory dumps, where the memory contents are printed out either on screen or using a printer. Find examples of memory dumps and find out why these are a very useful tool for program developers.
另一种在程序开发过程中跟踪错误的方法是使用内存转储,即在屏幕上或使用打印机打印出内存内容。查找内存转储的示例,了解为什么内存转储是程序开发人员非常有用的工具。
Figure 1.3 Example of error codes
图 1.3 错误代码示例

Media Access Control (MAC) addresses
媒体访问控制 (MAC) 地址

Media Access Control (MAC) address refers to a number which uniquely identifies a device on a network. The MAC address refers to the network interface card (NIC) which is part of the device. The MAC address is rarely changed so that a particular device can always be identified no matter where it is.
介质访问控制 (MAC) 地址是指唯一标识网络设备的一个数字。MAC 地址指的是作为设备一部分的网络接口卡(NIC)。MAC 地址很少更改,因此无论在哪里都能识别特定设备。

A MAC address is usually made up of 48 bits which are shown as 6 groups of two hexadecimal digits (although 64-bit addresses also exist):
MAC 地址通常由 48 位组成,显示为 6 组两个十六进制数字(也有 64 位地址):
N N N N N N D D D D D D N N N N N N D D D D D D NN-NN-NN-DD-DD-DDN N-N N-N N-D D-D D-D D
or 

NN:NN:NN:DD:DD:DD

where the first half ( N N N N N N ) ( N N N N N N ) (NN-NN-NN)(N N-N N-N N) is the identity number of the manufacturer of
其中, ( N N N N N N ) ( N N N N N N ) (NN-NN-NN)(N N-N N-N N) 的前半部分是该产品制造商的标识号。

the device and the second half ( D D D D D D ) D D D D D D ) DD-DD-DD)D D-D D-D D) is the serial number of the device.
后半部分( D D D D D D ) D D D D D D ) DD-DD-DD)D D-D D-D D) 是设备的序列号。

where the first half ( N N N N N N ) ( N N N N N N ) (NN-NN-NN)(N N-N N-N N) is the identity number of the manufacturer of
其中, ( N N N N N N ) ( N N N N N N ) (NN-NN-NN)(N N-N N-N N) 的前半部分是该产品制造商的标识号。

the device and the second half ( D D D D D D ) ( D D D D D D ) (DD-DD-DD)(D D-D D-D D) is the serial number of the device. For example:
后半部分 ( D D D D D D ) ( D D D D D D ) (DD-DD-DD)(D D-D D-D D) 是设备的序列号。例如

00 1 C B 3 4 F 25 FE 00 1 C B 3 4 F 25 FE 00-1C-B3-4F-25-FE00-1 \mathrm{C}-\mathrm{B3}-4 \mathrm{~F}-25-\mathrm{FE} is the MAC address of a device produced by the Apple Corporation (code: 001CB3) with a serial number of: 4F25FE. Very often lowercase hexadecimal letters are used in the MAC address: 00-1c-b3-4f-25-fe. Other manufacturer identification numbers include:
00 1 C B 3 4 F 25 FE 00 1 C B 3 4 F 25 FE 00-1C-B3-4F-25-FE00-1 \mathrm{C}-\mathrm{B3}-4 \mathrm{~F}-25-\mathrm{FE} 是 Apple 公司生产的设备(代码:001CB3)的 MAC 地址,序列号为 4F25FE:4F25FE。MAC 地址中通常使用小写十六进制字母:00-1C-B3-4F-25-FE。其他制造商标识号包括

00 14 22 00 14 22 00-14-2200-14-22 which identifies devices made by Dell
00 14 22 00 14 22 00-14-2200-14-22 可识别戴尔制造的设备

00 40 00 40 00-4000-40 - 96 which identifies devices made by Cisco
00 40 00 40 00-4000-40 - 96,用于识别 Cisco 制造的设备

Find out more 了解更多

Try to find the MAC addresses of some of your own devices le.g. mobile phone and tablet) and those found in the school.
尝试查找您自己的一些设备(如手机和平板电脑)和学校里的设备的 MAC 地址。
Refer to Chapter 3 for more detail on IP addresses.
有关 IP 地址的更多详情,请参阅第 3 章。

Find out more 了解更多

Try to find the IPv4 and IPv6 addresses of some of your own
尝试查找自己的一些 IPv4 和 IPv6 地址

devices (e.g. mobile of some of your own
设备(例如您自己的一些移动

devices le.g. mobile phone and tablet) and those found in the school.
手机和平板电脑等设备)和学校内的设备。
Refer to Chapter 3 for more detail on MAC addresses. \square
有关 MAC 地址的更多详情,请参阅第 3 章。 \square

00 - a0 - c9 which identifies devices made by Intel, and so on.
00 - a0 - c9 表示英特尔公司生产的设备,以此类推。

Internet Protocol (IP) addresses
互联网协议(IP)地址

Each device connected to a network is given an address known as the Internet Protocol (IP) address. An IPv4 address is a 32-bit number written in denary or hexadecimal form: e.g. 109.108.158.1 (or 77.76.9e. 01 in hex). IPv4 has recently been improved upon by the adoption of IPv6. An IPv6 address is a 128-bit number broken down into 16-bit chunks, represented by a hexadecimal number. For example:
每个连接到网络的设备都有一个地址,即互联网协议(IP)地址。IPv4 地址是以十进制或十六进制形式书写的 32 位数字:如 109.108.158.1(或十六进制 77.76.9e.01)。IPv4 最近通过采用 IPv6 得到了改进。IPv6 地址是一个 128 位的数字,分成 16 位的小块,用十六进制数字表示。例如

a8fb:7a88:fff0:0fff:3d21:2085:66fb:f0fa
Note IPv6 uses a colon (😃 rather than a decimal point (.) as used in IPv4.
注意 IPv6 使用冒号 (😃),而不是 IPv4 中使用的小数点 (.)。

HyperText Mark-up Language (HTML) colour codes
超文本标记语言(HTML)颜色代码

HyperText Mark-up Language (HTML) is used when writing and developing web pages. HTML isn’t a programming language but is simply a mark-up language. A mark-up language is used in the processing, definition and presentation of text (for example, specifying the colour of the text).
超文本标记语言(HTML)用于编写和开发网页。HTML 并非编程语言,而只是一种标记语言。标记语言用于处理、定义和呈现文本(例如,指定文本的颜色)。

HTML uses <tags> which are used to bracket a piece of text for example, <h1> and </h1> surround a top-level heading. Whatever is between the two tags has been defined as heading level 1 . Here is a short example of HTML code:
HTML 使用 <tags> 来括弧括住一段文本,例如,<h1> 和 </h1> 包围着一个顶级标题。这两个标签之间的内容被定义为一级标题。下面是一个简短的 HTML 代码示例:

<h1 style=“Color:#FF0000;”>This is a red heading</h1>
<h1 style="Color:#FF0000;">这是一个红色标题</h1>

<h2 style=“color:#00FF00;”>This is a green heading</h2>
<h2 style="color:#00FF00;">这是一个绿色标题</h2>

<h3 style=“color:#0000FF;”>This is a blue heading</h3>
<h3 style="color:#0000FF;">T 这是一个蓝色标题</h3>

Figure 1.4 图 1.4
HTML is often used to represent colours of text on the computer screen. All colours can be made up of different combinations of the three primary colours (red, green and blue). The different intensity of each colour (red, green and blue) is determined by its hexadecimal value. This means different hexadecimal values represent different colours. For example:
HTML 常用来表示计算机屏幕上文本的颜色。所有颜色都可以由三原色(红、绿、蓝)的不同组合构成。每种颜色(红、绿、蓝)的不同强度由其十六进制值决定。这意味着不同的十六进制值代表不同的颜色。例如

»# FF 0000 represents primary colour red
"# FF 0000 代表红色原色

》# 00 FF 00 represents primary colour green
》# 00 FF 00 代表绿色原色

》# 0000 FF represents primary colour blue
0000 FF 代表蓝色原色

》# FF 00 FF represents fuchsia
》# FF 00 FF 代表紫红色

》# FF 8000 represents orange
》# FF 8000 代表橙色

》# B1 8904 represents a tan colour,
B1 8904 代表棕褐色、

and so on producing almost any colour the user wants. The following diagrams show the various colours that can be selected by altering the hex ‘intensity’ of red, green and blue primary colours. The colour ‘FF9966’ has been chosen as an example:
以此类推,几乎可以产生用户想要的任何颜色。下图显示了通过改变红、绿、蓝三原色的十六进制 "强度 "可以选择的各种颜色。我们选择了 "FF9966 "作为示例:
FF9966
A Figure 1.5 Examples of HTML hex colour codes
图 1.5 HTML 十六进制颜色代码示例

The # symbol always precedes hexadecimal values in HTML code. The colour codes are always six hexadecimal digits representing the red, green and blue components. There are a possible 256 values for red, 256 values for green and 256 values for blue giving a total of 256 × 256 × 256 256 × 256 × 256 256 xx256 xx256256 \times 256 \times 256 (i.e. 16777216 ) possible colours.
在 HTML 代码中,十六进制值之前总是有 # 符号。颜色代码总是由六个十六进制数字组成,分别代表红色、绿色和蓝色。红色有 256 个值,绿色有 256 个值,蓝色有 256 个值,因此总共有 256 × 256 × 256 256 × 256 × 256 256 xx256 xx256256 \times 256 \times 256 (即 16777216)种可能的颜色。

Activity 1.7 活动 1.7

1 Using software on your computer (for example, text colour option in Word), find out what colours would be represented by the following RGB denary value combinations:
1 使用计算机上的软件(例如 Word 中的文本颜色选项),找出下列 RGB 代数值组合可以代表什么颜色:

a Red 53 a 红色 53
Green 55 绿色 55
b Red b 红色
201
Blue 139 蓝色 139
Green 绿色
122
Blue 蓝色
204
c Red c 红色
12
Green 绿色
2 Convert each of the above denary numbers into hexadecimal.
2 将上述每个二进制数转换成十六进制数。

1.1.4 Addition of binary numbers
1.1.4 二进制数的加法

This section will look at the addition of two 8-bit positive binary numbers.
本节将介绍两个 8 位二进制正数的加法运算。

Note the following key facts when carrying out addition of two binary digits:
在进行两位二进制数的加法运算时,请注意以下关键事实:
binary addition 二进制加法 carry 携带 sum 数额
0 + 0 0 + 0 0+00+0 0 0
0 + 1 0 + 1 0+10+1 0 1
1 + 0 1 + 0 1+01+0 0 1
1 + 1 1 + 1 1+11+1 1 0
binary addition carry sum 0+0 0 0 0+1 0 1 1+0 0 1 1+1 1 0| binary addition | carry | sum | | :---: | :---: | :---: | | $0+0$ | 0 | 0 | | $0+1$ | 0 | 1 | | $1+0$ | 0 | 1 | | $1+1$ | 1 | 0 |
This can then be extended to consider the addition of three binary digits:
进而可以扩展到考虑三个二进制数的加法:
binary digit 二进制数位 carry 携带 sum 数额
0 + 0 + 0 0 + 0 + 0 0+0+00+0+0 0 0
0 + 0 + 1 0 + 0 + 1 0+0+10+0+1 0 1
0 + 1 + 0 0 + 1 + 0 0+1+00+1+0 0 1
0 + 1 + 1 0 + 1 + 1 0+1+10+1+1 1 0
1 + 0 + 0 1 + 0 + 0 1+0+01+0+0 0 1
1 + 0 + 1 1 + 0 + 1 1+0+11+0+1 1 0
1 + 1 + 0 1 + 1 + 0 1+1+01+1+0 1 0
1 + 1 + 1 1 + 1 + 1 1+1+11+1+1 1 1
binary digit carry sum 0+0+0 0 0 0+0+1 0 1 0+1+0 0 1 0+1+1 1 0 1+0+0 0 1 1+0+1 1 0 1+1+0 1 0 1+1+1 1 1| binary digit | carry | sum | | :---: | :---: | :---: | | $0+0+0$ | 0 | 0 | | $0+0+1$ | 0 | 1 | | $0+1+0$ | 0 | 1 | | $0+1+1$ | 1 | 0 | | $1+0+0$ | 0 | 1 | | $1+0+1$ | 1 | 0 | | $1+1+0$ | 1 | 0 | | $1+1+1$ | 1 | 1 |
For comparison: if we add 7 and 9 in denary the result is: carry = 1 = 1 =1=1 and sum = 6 = 6 =6=6; if we add 7,9 and 8 the result is: carry = 2 = 2 =2=2 and sum = 4 = 4 =4=4, and so on.
比较一下:如果我们把 7 和 9 相加,结果是:进位 = 1 = 1 =1=1 ,和 = 6 = 6 =6=6 ;如果我们把 7、9 和 8 相加,结果是:进位 = 2 = 2 =2=2 ,和 = 4 = 4 =4=4 ,以此类推。

Advice 建议

Here’s a quick recap on the role of carry and sum. If we want to add the numbers 97 and 64 in decimal, we:
下面简要回顾一下进位和和的作用。如果我们想把十进制数 97 和 64 相加,我们应该
  • add the numbers in the right hand column first
    先将右栏的数字相加
  • if the sum is greater than 9 then we carry a value to the next column
    如果总和大于 9,则将一个值转入下一列
  • we continue moving left, adding any carry values to each column until we are finished.
    我们继续向左移动,在每一列中添加任何携带值,直到完成为止。
For instance: 例如
97 + 64 11 CARRY VALUES 97 + 64 11  CARRY VALUES  97+64=11" CARRY VALUES "\begin{array}{r} 97 \\ +\quad 64 \\ \hline 11 \text { CARRY VALUES } \\ \hline \end{array}

161 SUM VALUES

Adding in binary follows the same rules except that we carry whenever the sum is greater than 1.
二进制加法也遵循同样的规则,只是只要总和大于 1,我们就进行运算。

? Example 1 ?示例 1

Add 00100111 + 01001010 00100111 + 01001010 00100111+0100101000100111+01001010 添加 00100111 + 01001010 00100111 + 01001010 00100111+0100101000100111+01001010
We will set this out showing carry and sum values:
我们将显示进位值和和值:

? Example 2 ?示例 2

a Convert 126 and 62 into binary.
a 将 126 和 62 转换成二进制。

b Add the two binary values in part a and check the result matches the addition of the two denary numbers
b 将 a 部分中的两个二进制值相加,并检查结果是否与两个二进制数相加的结果一致

10111100 has the equivalent denary value of 128 + 32 + 16 + 8 + 4 = 188 128 + 32 + 16 + 8 + 4 = 188 128+32+16+8+4=188128+32+16+8+4=188 which is the same as 126 + 62 126 + 62 126+62126+62.
10111100 的对应面值为 128 + 32 + 16 + 8 + 4 = 188 128 + 32 + 16 + 8 + 4 = 188 128+32+16+8+4=188128+32+16+8+4=188 ,与 126 + 62 126 + 62 126+62126+62 相同。

Activity 1.8 活动 1.8

Carry out the following binary additions:
进行以下二进制加法运算:
a 00011101 + 01100110 00011101 + 01100110 00011101+0110011000011101+01100110 f f ff 00111100 + 01111011 00111100 + 01111011 00111100+0111101100111100+01111011
b 00100111 + 00111111 00100111 + 00111111 00100111+0011111100100111+00111111 g 00111111 + 00111111 00111111 + 00111111 00111111+0011111100111111+00111111
c 00101110 + 01001101 00101110 + 01001101 00101110+0100110100101110+01001101 h 00110001 + 00111111 00110001 + 00111111 00110001+0011111100110001+00111111
d 01110111 + 00111111 01110111 + 00111111 01110111+0011111101110111+00111111 i. 01111111 + 011111 01111111 + 011111 01111111+01111101111111+011111
00111100 + 00110011 00111100 + 00110011 00111100+0011001100111100+00110011 j 10100010 + 001110 10100010 + 001110 10100010+00111010100010+001110
a 00011101+01100110 f 00111100+01111011 b 00100111+00111111 g 00111111+00111111 c 00101110+01001101 h 00110001+00111111 d 01110111+00111111 i. 01111111+011111 00111100+00110011 j 10100010+001110| a | $00011101+01100110$ | $f$ | $00111100+01111011$ | | :---: | :---: | :---: | :---: | | b | $00100111+00111111$ | g | $00111111+00111111$ | | c | $00101110+01001101$ | h | $00110001+00111111$ | | d | $01110111+00111111$ | i. | $01111111+011111$ | | | $00111100+00110011$ | j | $10100010+001110$ |

Activity 1.9 活动 1.9

Convert the following denary numbers into binary and then carry out the binary addition of the two numbers and check your answer against the equivalent denary sum:
将下列二进制数转换成二进制数,然后将两个数进行二进制加法运算,并将答案与等价的二进制和进行核对:

a 98 + 15 98 + 15 98+1598+15
d 51 + 171 51 + 171 51+17151+171
g 19 + 139 19 + 139 19+13919+139
j 211 + 35 211 + 35 211+35211+35
b 29 + 88 29 + 88 29+8829+88
e 82 + 69 82 + 69 82+6982+69
h 203 + 30 203 + 30 203+30203+30
c 49 + 100 49 + 100 49+10049+100
f 100 + 140 100 + 140 100+140100+140
i 66 + 166 66 + 166 66+16666+166

Overflow 溢出

Now consider the following example:
现在请看下面的例子:

Example 3 示例 3

Add 01101110 and 11011110 (using bits)
添加 01101110 和 11011110(使用比特)
This addition has generated a 9th bit. The 8 bits of the answer are 01001100 - this gives the denary value ( 64 + 8 + 4 ) ( 64 + 8 + 4 ) (64+8+4)(64+8+4) of 76 which is incorrect because the denary value of the addition is 110 + 222 = 332 110 + 222 = 332 110+222=332110+222=332.
这个加法产生了第 9 位。答案的 8 位是 01001100 - 由此得到的面值 ( 64 + 8 + 4 ) ( 64 + 8 + 4 ) (64+8+4)(64+8+4) 是 76,这是不正确的,因为加法的面值是 110 + 222 = 332 110 + 222 = 332 110+222=332110+222=332
The maximum denary value of an 8 -bit binary number is 255 (which is 2 8 1 2 8 1 2^(8)-12^{8}-1 ). The generation of a 9 th bit is a clear indication that the sum has exceeded this value. This is known as an overflow error and in this case is an indication that a number is too big to be stored in the computer using 8 bits.
8 位二进制数的最大示值是 255(即 2 8 1 2 8 1 2^(8)-12^{8}-1 )。第 9 位的产生清楚地表明总和已经超过了这个值。这就是所谓的溢出错误,在这种情况下,表明一个数字太大,无法用 8 位存储在计算机中。

The greater the number of bits which can be used to represent a number then the larger the number that can be stored. For example, a 16-bit register would allow a maximum denary value of 65535 (i.e. 2 16 2 16 2^(16)2^{16} - 1) to be stored, a 32 -bit register would allow a maximum denary value of 4294967295 (i.e. 2 32 1 2 32 1 2^(32)-12^{32}-1 ), and so on.
可用于表示数字的位数越多,可存储的数字就越大。例如,16 位寄存器可存储的最大面值为 65535(即 2 16 2 16 2^(16)2^{16} -1),32 位寄存器可存储的最大面值为 4294967295(即 2 32 1 2 32 1 2^(32)-12^{32}-1 ),以此类推。

Activity 1.10 活动 1.10

1 Convert the following pairs of denary numbers to 8 -bit binary numbers and then add the binary numbers. Comment on your answers in each case:
1 将下列一对二进制数转换成 8 位二进制数,然后将二进制数相加。对每种情况的答案进行评述:

a 89 + 175 89 + 175 89+17589+175
b 168 + 99 168 + 99 168+99168+99
c 88 + 215 88 + 215 88+21588+215
2 Carry out the following 16-bit binary additions and comment on your answers: a 0111111111110001 + 0101111100111001 0111111111110001 + 0101111100111001 0111111111110001+01011111001110010111111111110001+0101111100111001
2 执行下列 16 位二进制加法运算,并对答案作出评述: a 0111111111110001 + 0101111100111001 0111111111110001 + 0101111100111001 0111111111110001+01011111001110010111111111110001+0101111100111001

b 1110111000001011 + 1111110111011001 1110111000001011 + 1111110111011001 1110111000001011+11111101110110011110111000001011+1111110111011001

1.1.5 Logical binary shifts
1.1.5 逻辑二进制移位

Computers can carry out a logical shift on a sequence of binary numbers. The logical shift means moving the binary number to the left or to the right. Each shift left is equivalent to multiplying the binary number by 2 and each shift right is equivalent to dividing the binary number by 2.
计算机可以对二进制数序列进行逻辑移位。逻辑移位意味着将二进制数向左或向右移动。每次向左移动相当于二进制数乘以 2,每次向右移动相当于二进制数除以 2。

As bits are shifted, any empty positions are replaced with a zero - see examples below. There is clearly a limit to the number of shifts which can be carried out if the binary number is stored in an 8-bit register. Eventually after a number of shifts the register would only contain zeros. For example, if we shift 01110000 (denary value 112) five places left (the equivalent to multiplying by 2 5 2 5 2^(5)2^{5}, i.e. 32 ), in an 8 -bit register we would end up with 00000000 . This makes it seem as though 112 × 32 = 0 112 × 32 = 0 112 xx32=0112 \times 32=0 ! This would result in the generation of an error message.
在位移过程中,任何空位都会被 0 所取代--请参见下面的示例。如果将二进制数存储在 8 位寄存器中,移位的次数显然是有限的。最终,经过多次移位后,寄存器中将只包含 0。例如,如果我们将 01110000(面值 112)向左移动五位(相当于乘以 2 5 2 5 2^(5)2^{5} ,即 32),那么在 8 位寄存器中,最终结果将是 00000000。这就好像是 112 × 32 = 0 112 × 32 = 0 112 xx32=0112 \times 32=0 !这样就会产生一条错误信息。

? Example 1 ?示例 1

The denary number 21 is 00010101 in binary. If we put this into an 8 -bit register:
21 的二进制数为 00010101。如果我们将其放入一个 8 位寄存器:
The left-most bit is often referred to as the MOST SIGNIFICANT BIT
最左边的位通常被称为最重要位(MOST SIGNIFICANT BIT)。
The left-most bit is now lost following a left shift
左移后,最左边的位将丢失
Suppose we now shift the original number two places left:
假设我们现在将原来的数字向左移动两位:
128 64 32 16 8 4 2 1
0 1 0 1 0 1 0 0
128 64 32 16 8 4 2 1 0 1 0 1 0 1 0 0| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 |
The binary number 1010100 is 84 in denary - this is 21 × 2 2 21 × 2 2 21 xx2^(2)21 \times 2^{2}.
二进制数 1010100 的面值为 84 - 即 21 × 2 2 21 × 2 2 21 xx2^(2)21 \times 2^{2} .

And now suppose we shift the original number three places left:
现在,假设我们将原来的数字向左移动三位:
1 0 1 0 1 0 0 0
1 0 1 0 1 0 0 0| 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
The binary number 10101000 is 168 in denary - this is 21 × 2 3 21 × 2 3 21 xx2^(3)21 \times 2^{3}.
二进制数 10101000 的面值为 168,即 21 × 2 3 21 × 2 3 21 xx2^(3)21 \times 2^{3}

So, let us consider what happens if we shift the original binary number 00010101 four places left:
因此,让我们考虑一下,如果将原来的二进制数 00010101 向左移动四位会发生什么情况:
Losing 1 bit 丢失 1 位
following a shift 轮班后
Losing 1 bit following a shift| Losing 1 bit | | :--- | | following a shift |
\square
128 64 32 16 8 4 2 1
0 1 0 1 0 0 0 0
128 64 32 16 8 4 2 1 0 1 0 1 0 0 0 0| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 |
The left-most 1-bit has been lost. In our 8-bit register the result of 21 × 2 4 21 × 2 4 21 xx2^(4)21 \times 2^{4} is 80 which is clearly incorrect. This error is because we have exceeded the maximum number of left shifts possible using this register.
最左边的 1 位已经丢失。在我们的 8 位寄存器中, 21 × 2 4 21 × 2 4 21 xx2^(4)21 \times 2^{4} 的结果是 80,这显然是不正确的。出现这个错误的原因是我们已经超过了这个寄存器的最大左移次数。

? Example 2 ?示例 2

The denary number 200 is 11001000 in binary. Putting this into an 8 -bit register gives:
200 的二进制数为 11001000。将其输入 8 位寄存器,结果如下
128 64 32 16 8 4 2 1
1 1 0 0 1 0 0 0
128 64 32 16 8 4 2 1 1 1 0 0 1 0 0 0| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 |
If we now shift the bits in this register one place to the right: \begin{tabular}{l}
如果我们现在将寄存器中的位向右移动一位:\{pos(192,289)}开始{pos(192,289)}结束
The right-most bit 最右边的位
is often referred to 通常指
as the LEAST 作为最不
The right-most bit is often referred to as the LEAST| The right-most bit | | :--- | | is often referred to | | as the LEAST |

SIGNIFICANT BIT 有效位数
\end{tabular} \结束
Note how the leftmost bit position is now filled with a 0
请注意,最左边的比特位置现在填上了 0
128 64 32 16 8 4 2 1
0 1 1 0 0 1 0 0
128 64 32 16 8 4 2 1 0 1 1 0 0 1 0 0| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 |
The value of the binary bits is now 200 ÷ 2 1 200 ÷ 2 1 200-:2^(1)200 \div 2^{1} i.e. 100 . We can see this is correct by converting the new binary number 01100100 to denary ( 64 + 32 + 4 ) ( 64 + 32 + 4 ) (64+32+4)(64+32+4).
现在二进制位的值是 200 ÷ 2 1 200 ÷ 2 1 200-:2^(1)200 \div 2^{1} ,即 100。我们可以将新的二进制数 01100100 转换为二进制数 ( 64 + 32 + 4 ) ( 64 + 32 + 4 ) (64+32+4)(64+32+4) ,从而得出正确的结果。
Suppose we now shift the original number two places to the right:
假设我们现在将原来的数字向右移动两位:
128 64 32 16 8 4 2 1
0 0 1 1 0 0 1 0
128 64 32 16 8 4 2 1 0 0 1 1 0 0 1 0| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 |
The binary number 00110010 is 50 in denary - this is 200 ÷ 2 2 200 ÷ 2 2 200-:2^(2)200 \div 2^{2}.
二进制数 00110010 的面值是 50,即 200 ÷ 2 2 200 ÷ 2 2 200-:2^(2)200 \div 2^{2} .

And suppose we now shift the original number three places to the right:
假设我们现在将原来的数字向右移动三位:

Notice the 1-bit from the rightmost bit position is now lost causing an error
请注意,最右边比特位置的 1 比特现在丢失了,导致出错
128 64 32 16 8 4 2 1
0 0 0 1 1 0 0 1
128 64 32 16 8 4 2 1 0 0 0 1 1 0 0 1| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 |
The binary number 00011001 is 25 in denary - this is 200 ÷ 2 3 200 ÷ 2 3 200-:2^(3)200 \div 2^{3}.
二进制数 00011001 的面值为 25,即 200 ÷ 2 3 200 ÷ 2 3 200-:2^(3)200 \div 2^{3} .

Now let us consider what happens if we shift four places right:
现在让我们考虑一下,如果我们向右移动四个位置会发生什么情况:
128 64 32 16 8 4 2 1
0 0 0 0 1 1 0 0
128 64 32 16 8 4 2 1 0 0 0 0 1 1 0 0| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 |
The right-most 1-bit has been lost. In our 8-bit register the result of 200 ÷ 2 4 200 ÷ 2 4 200-:2^(4)200 \div 2^{4} is 12 , which is clearly incorrect. This error is because we have therefore exceeded the maximum number of right shifts possible using this 8 -bit register.
最右边的 1 位已经丢失。在我们的 8 位寄存器中, 200 ÷ 2 4 200 ÷ 2 4 200-:2^(4)200 \div 2^{4} 的结果是 12,这显然是不正确的。出现这个错误的原因是,我们已经超过了这个 8 位寄存器的最大右移次数。

? ? ?? Example 3  ? ? ?? 例 3

a Write 24 as an 8-bit register.
a 将 24 写入 8 位寄存器。

b Show the result of a logical shift 2 places to the left.
b 显示向左逻辑移动 2 位的结果。

c Show the result of a logical shift 3 places to the right.
c 显示向右逻辑移动 3 位的结果。

b
128 64 32 16 8 4 2 1
0 1 1 0 0 0 0 0
128 64 32 16 8 4 2 1 0 1 1 0 0 0 0 0| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 |
C 128 64 32 16 8 4 2 1  C  128 64 32 16 8 4 2 1 {:[" C ",128,64,32,16,8,4,2,1]:}\begin{array}{lllllllll}\text { C } & 128 & 64 & 32 & 16 & 8 & 4 & 2 & 1\end{array}
0 0 0 0 0 - 24 ÷ 2 3 = 3 24 ÷ 2 3 = 3 24-:2^(3)=324 \div 2^{3}=3
0 0 0 0 0 - 24-:2^(3)=3| 0 | 0 | 0 | | 0 | 0 | | - $24 \div 2^{3}=3$ | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |

? ? ?? Example 4  ? ? ?? 例 4

a Convert 19 and 17 into binary.
a 将 19 和 17 转换成二进制。

b Carry out the binary addition of the two numbers.
b 进行两个数的二进制加法。

c Shift your result from part b two places left and comment on the result.
c 将 b 部分的结果向左移动两位,并对结果作出评论。

d Shift your result from part b b bb three places right and comment on the result.
d 将第 b b bb 部分的结果向右移动三位,并对结果进行评论。

a
128 64 32 16 8 4 2 1
0 0 0 1 0 0 1 1
0 0 0 1 0 0 0 1
128 64 32 16 8 4 2 1 0 0 0 1 0 0 1 1 0 0 0 1 0 0 0 1| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 |
In c the result is 36 × 2 2 = 144 36 × 2 2 = 144 36 xx2^(2)=14436 \times 2^{2}=144 (which is correct).
在 c 中,结果是 36 × 2 2 = 144 36 × 2 2 = 144 36 xx2^(2)=14436 \times 2^{2}=144 (这是正确的)。

In d the result of the right shift gives a value of 4 , which is incorrect since 36 ÷ 2 3 36 ÷ 2 3 36-:2^(3)36 \div 2^{3} is not 4 ; therefore, the number of possible right shifts has been exceeded. You can also see that a 1 has been lost from the original binary number, which is another sign that there have been too many right shifts.
在 d 中,右移的结果是 4,这是不正确的,因为 36 ÷ 2 3 36 ÷ 2 3 36-:2^(3)36 \div 2^{3} 不是 4;因此,可能的右移次数已经超过。您还可以看到,原始二进制数中丢失了一个 1,这也是右移次数过多的另一个迹象。

Activity 1.11 活动 1.11

1 a Write down the denary value of the following binary number.
1 a 写出下列二进制数的二进制值。
0 1 1 0 1 0 0 0
0 1 1 0 1 0 0 0| 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
b Shift the binary number three places to the right and comment on your result.
b 将二进制数向右移动三位,并对结果作出评论。

c Write down the denary value of the following binary number.
c 写出下列二进制数的二进制值。
0 0 0 0 1 1 1 1
0 0 0 0 1 1 1 1| 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
d Shift the binary number four places to the left and comment on your result.
d 将二进制数向左移动四位,并对结果发表评论。

2 a Convert 29 and 51 to 8-bit binary numbers.
2 a 将 29 和 51 转换为 8 位二进制数。

b Add the two binary numbers in part a.
b 将 a 部分中的两个二进制数相加。

c Shift the result in part b three places to the right.
c 将 b 部分的结果向右移动三位。

d Convert 75 to an 8-bit binary number.
d 将 75 转换为 8 位二进制数。

e Add the two binary numbers from parts c c c\mathbf{c} and d d d\mathbf{d}.
e 将 c c c\mathbf{c} 部分和 d d d\mathbf{d} 部分的两个二进制数相加。

f Shift your result from part e one place to the left.
f 将 e 部分的结果向左移动一位。

1.1.6 Two's complement (binary numbers)
1.1.6 二进制补码(二进制数)

Up until now, we have assumed all binary numbers are positive integers. To allow the possibility of representing negative integers we make use of two’s complement. In this section we will again assume 8 -bit registers are being used. Only one minor change to the binary headings needs to be introduced here:
到目前为止,我们一直假设所有二进制数都是正整数。为了能够表示负整数,我们使用了二进制。在本节中,我们将再次假设使用 8 位寄存器。这里只需对二进制标题稍作改动:
-128 64 32 16 8 4 2 1
-128 64 32 16 8 4 2 1 | -128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | | | | | | | | | | | | | | | | | | |
In two’s complement the left-most bit is changed to a negative value. For instance, for an 8 -bit number, the value 128 is now changed to -128 , but all the other headings remain the same. This means the new range of possible numbers is: -128 (10000000) to +127 (01111111).
在二进制补码中,最左边的一位变为负值。例如,对于一个 8 位数,128 现在变为-128,但所有其他标题保持不变。这意味着新的可能数字范围是:-128(10000000)至 +127(01111111)。

It is important to realise when applying two’s complement to a binary number that the left-most bit always determines the sign of the binary number. A 1-value in the left-most bit indicates a negative number and a 0 -value in the leftmost bit indicates a positive number (for example, 00110011 represents 51 and 11001111 represents -49).
在对二进制数进行二进制补码运算时,最左边的一位总是决定二进制数的符号,这一点很重要。最左边位的 1 表示负数,最左边位的 0 表示正数(例如,00110011 表示 51,11001111 表示-49)。

Writing positive binary numbers in two's complement format
用二进制补码格式写正二进制数

? ? ?? Example 1  ? ? ?? 示例 1

The following two examples show how we can write the following positive binary numbers in the two’s complement format 19 and 4:
下面两个示例说明了如何用二进制补码格式写出下面的正二进制数 19 和 4:
-128 64 32 16 8 4 2 1
0 0 0 1 0 0 1 1
0 0 0 0 0 1 0 0
-128 64 32 16 8 4 2 1 0 0 0 1 0 0 1 1 0 0 0 0 0 1 0 0| -128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
As you will notice, for positive binary numbers, it is no different to what was done in Section 1.1.2.
正如你所注意到的,对于正二进制数,这与第 1.1.2 节中所做的并无不同。

Converting positive denary numbers to binary numbers in the two's complement format
以二进制格式将正二进制数转换为二进制数

If we wish to convert a positive denary number to the two’s complement format, we do exactly the same as in Section 1.1.2:
如果要将一个正二进制数转换为二进制格式,我们的步骤与第 1.1.2 节完全相同:

? ? ?? Example 2  ? ? ?? 示例 2

Convert a 38 b 125 to 8 -bit binary numbers using the two’s complement format. a Since this number is positive, we must have a zero in the -128 column. It is then a simple case of putting 1 -values into their correct positions to make up the value of 38 :
使用二进制格式将 a 38 b 125 转换为 8 位二进制数。 a 由于这个数是正数,因此 -128 列中必须有一个零。因此,只需将 1 值放到正确的位置,就可以组成 38 的值:
-128 64 32 16 8 4 2 1
0 0 1 0 0 1 1 0
-128 64 32 16 8 4 2 1 0 0 1 0 0 1 1 0| -128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 |
b Again, since this is a positive number, we must have a zero in the -128 column. As in part a, we then place 1 -values in the appropriate columns to make up the value of 125 :
b 同样,由于这是一个正数,我们必须在 -128 列中有一个零。和 a 部分一样,我们在相应的列中放入 1 - 值,组成 125 的值:
0 1 1 1 1 1 0 1
0 1 1 1 1 1 0 1| 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
Converting positive binary numbers in the two’s complement format to positive denary numbers
将二进制格式的正二进制数转换为正二进制数

? ? ?? Example 3  ? ? ?? 例 3

Convert 01101110 in two’s complement binary into denary:
将 01101110 的二进制补码转换为二进制:
-128 64 32 16 8 4 2 1
0 1 1 0 1 1 1 0
-128 64 32 16 8 4 2 1 0 1 1 0 1 1 1 0| -128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 |
As in Section 1.1.2, each time a 1 appears in a column, the column value is added to the total. For example, the binary number ( 01101110 ) above has the following denary value: 64 + 32 + 8 + 4 + 2 = 110 64 + 32 + 8 + 4 + 2 = 110 64+32+8+4+2=11064+32+8+4+2=110.
如第 1.1.2 节所述,每当一列中出现 1,该列的数值就会加到总数中。例如,上面的二进制数 ( 01101110 ) 的面值如下: 64 + 32 + 8 + 4 + 2 = 110 64 + 32 + 8 + 4 + 2 = 110 64+32+8+4+2=11064+32+8+4+2=110

Example 4 示例 4

Convert 00111111 in two’s complement binary into denary:
将二进制补码 00111111 转换为二进制:
-128 64 32 16 8 4 2 1
0 0 1 1 1 1 1 1
-128 64 32 16 8 4 2 1 0 0 1 1 1 1 1 1| -128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 |
As above, each time a 1 appears in a column, the column value is added to the total. For example, the binary number (00111111) above has the following denary value: 32 + 16 + 8 + 4 + 2 + 1 = 63 32 + 16 + 8 + 4 + 2 + 1 = 63 32+16+8+4+2+1=6332+16+8+4+2+1=63.
如上所述,每当一列中出现一个 1,该列的数值就会加到总数中。例如,上面的二进制数 (00111111) 的面值如下: 32 + 16 + 8 + 4 + 2 + 1 = 63 32 + 16 + 8 + 4 + 2 + 1 = 63 32+16+8+4+2+1=6332+16+8+4+2+1=63

Activity 1.12 活动 1.12

1 Convert the following positive denary numbers into 8-bit binary numbers in the two’s complement format:
1 将下列正二进制数转换成二进制补码格式的 8 位二进制数:

a 39
c 88
e 111
g 77
i 49
b 66
d 102
f 125
h 20
j 56
2 Convert the following binary numbers (written in two’s complement format) into positive denary numbers:
2 将下列二进制数(以二进制格式写出)转换成正二进制数:

Writing negative binary numbers in two's complement format and converting to denary
以二进制补码格式写入负二进制数并转换为十进制数

? ? ?? Example 1  ? ? ?? 示例 1

The following three examples show how we can write negative binary numbers in the two’s complement format:
以下三个示例展示了如何用二进制补码格式写出负二进制数:
-128 64 32 16 8 4 2 1
1 0 0 1 0 0 1 1
-128 64 32 16 8 4 2 1 1 0 0 1 0 0 1 1| -128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 |
By following our normal rules, each time a 1 appears in a column, the column value is added to the total. So, we can see that in denary this is: 128 + 16 + 2 + 1 = 109 128 + 16 + 2 + 1 = 109 -128+16+2+1=-109-128+16+2+1=-109.
按照我们通常的规则,每当一列中出现一个 1,该列的数值就会加到总数中。因此,我们可以看到,在二进制中,这是 128 + 16 + 2 + 1 = 109 128 + 16 + 2 + 1 = 109 -128+16+2+1=-109-128+16+2+1=-109
-128 64 32 16 8 4 2 1
1 1 1 0 0 1 0 0
-128 64 32 16 8 4 2 1 1 1 1 0 0 1 0 0| -128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 |
Similarly, in denary this number is 128 + 64 + 32 + 4 = 28 128 + 64 + 32 + 4 = 28 -128+64+32+4=-28-128+64+32+4=-28.
同样,这个数字在二进制中为 128 + 64 + 32 + 4 = 28 128 + 64 + 32 + 4 = 28 -128+64+32+4=-28-128+64+32+4=-28
-128 64 32 16 8 4 2 1
1 1 1 1 0 1 0 1
-128 64 32 16 8 4 2 1 1 1 1 1 0 1 0 1| -128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 |
This number is equivalent to 128 + 64 + 32 + 16 + 4 + 1 = 11 128 + 64 + 32 + 16 + 4 + 1 = 11 -128+64+32+16+4+1=-11-128+64+32+16+4+1=-11.
该数字等同于 128 + 64 + 32 + 16 + 4 + 1 = 11 128 + 64 + 32 + 16 + 4 + 1 = 11 -128+64+32+16+4+1=-11-128+64+32+16+4+1=-11
Note that a two’s complement number with a 1-value in the -128 column must represent a negative binary number.
请注意,-128 列中有 1 值的二进制补码必须表示负二进制数。

Converting negative denary numbers into binary numbers in two's complement format
将负二进制数转换为二进制数的二进制补码格式

Consider the number +67 in 8 -bit (two’s complement) binary format:
考虑一下 8 位(二进制补码)二进制格式的数字 +67:
-128 64 32 16 8 4 2 1
0 1 0 0 0 0 1 1
-128 64 32 16 8 4 2 1 0 1 0 0 0 0 1 1| -128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 |

Method 1 方法 1

Now let’s consider the number -67. One method of finding the binary equivalent to -67 is to simply put 1 s in their correct places:
现在我们来看看数字-67。找到相当于 -67 的二进制数的一种方法是简单地将 1 放到正确的位置上:
-128 64 32 16 8 4 2 1
1 0 1 1 1 1 0 1
-128 64 32 16 8 4 2 1 1 0 1 1 1 1 0 1| -128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 |
< < <<
128 + 32 + 16 + 8 128 + 32 + 16 + 8 -128+32+16+8-128+32+16+8
+ 4 + 1 = 67 + 4 + 1 = 67 +4+1=-67+4+1=-67
-128+32+16+8 +4+1=-67| $-128+32+16+8$ | | :--- | | $+4+1=-67$ |

Method 2 方法 2

However, looking at the two binary numbers above, there is another possible way to find the binary representation of a negative denary number:
不过,从上面的两个二进制数来看,还有另一种可能的方法来找到负二进制数的二进制表示:

Example 2 示例 2

Convert -79 into an 8-bit binary number using two’s complement format.
使用二进制格式将 -79 转换为 8 位二进制数。

Method 1 方法 1

As it is a negative number, we need a 1 -value in the -128 column.
由于是负数,我们需要在 -128 列中输入 1 - 值。

-79 is the same as 128 + 49 128 + 49 -128+49-128+49
-79与 128 + 49 128 + 49 -128+49-128+49 相同

We can make up 49 from 32 + 16 + 1 32 + 16 + 1 32+16+132+16+1; giving:
我们可以从 32 + 16 + 1 32 + 16 + 1 32+16+132+16+1 中补足 49;给予:
-128 64 32 16 8 4 2 1
1 0 1 1 0 0 0 1
-128 64 32 16 8 4 2 1 1 0 1 1 0 0 0 1| -128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 1 |
Method 2 方法 2
write 79 in binary: 以二进制写入 79: 01001111
invert the binary digits:
反转二进制数字:
10110000
add 1 to the inverted number
加 1
1
thus giving -79: 从而得出-79: 10110001
write 79 in binary: 01001111 invert the binary digits: 10110000 add 1 to the inverted number 1 thus giving -79: 10110001| write 79 in binary: | 01001111 | | :--- | ---: | | invert the binary digits: | 10110000 | | add 1 to the inverted number | 1 | | thus giving -79: | 10110001 |
-128 64 32 16 8 4 2 1
1 0 1 1 0 0 0 1
-128 64 32 16 8 4 2 1 1 0 1 1 0 0 0 1| -128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 1 |
It is a good idea to practise both methods.
练习这两种方法是个好主意。
When applying two’s complement, it isn’t always necessary for a binary number to have 8 bits:
在应用二进制补码时,二进制数并不总是必须有 8 位:

Example 3 示例 3

The following 4-bit binary number represents denary number 6:
下面的 4 位二进制数代表第 6 个面值:
-8 4 2 1
0 1 1 0
-8 4 2 1 0 1 1 0| -8 | 4 | 2 | 1 | | :--- | :--- | :--- | :--- | | 0 | 1 | 1 | 0 |
Applying two’s complement (1 001 + 1 001 + 1 001+1001+1 ) would give:
应用二的补码(1 001 + 1 001 + 1 001+1001+1 )就可以得到:
4 4 2 1
1 0 1 0
4 4 2 1 1 0 1 0| 4 | 4 | 2 | 1 | | :--- | :--- | :--- | :--- | | 1 | 0 | 1 | 0 |
in other words: -6 换句话说-6

? ? ?? Example 4  ? ? ?? 例 4

The following 12-bit binary number represents denary number 1676:
下面的 12 位二进制数代表 1676 号面额:
-2048 1024 512 256 128 64 32 16 8 4 2 1
0 1 1 0 1 0 0 0 1 1 0 0
-2048 1024 512 256 128 64 32 16 8 4 2 1 0 1 1 0 1 0 0 0 1 1 0 0| -2048 | 1024 | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 |
Applying two’s complement (100101110011+1) would give:
应用二进制(100101110011+1)就可以得到:
-2048 1024 512 256 128 64 32 16 8 4 2 1
1 0 0 1 0 1 1 1 0 1 0 0
-2048 1024 512 256 128 64 32 16 8 4 2 1 1 0 0 1 0 1 1 1 0 1 0 0| -2048 | 1024 | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 |
In other words: -1676 换句话说-1676

Activity 1.13 活动 1.13

Convert the following negative denary numbers into binary numbers using the two’s complement format:
使用二进制补码格式将下列负二进制数转换为二进制数:

a -18
c -47
e -88
g -100
i -16
b -31
d -63
f -92
h -1
j -127

Activity 1.14 活动 1.14

Convert the following negative binary numbers (written in two’s complement format) into negative denary numbers:
将下列二进制负数(以二进制格式写出)转换为二进制负数:
a 1 1 0 0 1 1 0 1
b 1 0 1 1 1 1 1 0
c 1 1 1 0 1 1 1 1
d 1 0 0 0 0 1 1 1
e 1 0 1 0 0 0 0 0
f 1 1 1 1 1 0 0 1
g 1 0 1 0 1 1 1 1
h 1 1 1 1 1 1 1 1
i 1 0 0 0 0 0 0 1
j 1 1 1 1 0 1 1 0
a 1 1 0 0 1 1 0 1 b 1 0 1 1 1 1 1 0 c 1 1 1 0 1 1 1 1 d 1 0 0 0 0 1 1 1 e 1 0 1 0 0 0 0 0 f 1 1 1 1 1 0 0 1 g 1 0 1 0 1 1 1 1 h 1 1 1 1 1 1 1 1 i 1 0 0 0 0 0 0 1 j 1 1 1 1 0 1 1 0| a | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | b | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | | c | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | | d | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | | e | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | | f | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | | g | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | | h | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | | i | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | | j | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 0 |

1.2 Text, sound and images
1.2 文字、声音和图像

1.2.1 Character sets - ASCII code and Unicode
1.2.1 字符集 - ASCII 码和统一码

The ASCII code system (American Standard Code for Information Interchange) was set up in 1963 for use in communication systems and computer systems. A newer version of the code was published in 1986. The standard ASCII code character set consists of 7-bit codes ( 0 to 127 in denary or 00 to 7 F 7 F 7F7 F in
ASCII 码系统(美国信息交换标准码)于 1963 年建立,用于通信系统和计算机系统。该编码的更新版本于 1986 年发布。标准 ASCII 码字符集由 7 位代码组成(单位为 0 至 127,单位为 7 F 7 F 7F7 F )。

hexadecimal) that represent the letters, numbers and characters found on a standard keyboard, together with 32 control codes (that use codes 0 to 31 (denary) or 00 to 19 (hexadecimal)).
十六进制),代表标准键盘上的字母、数字和字符,以及 32 个控制代码(使用代码 0 至 31(二进制)或 00 至 19(十六进制))。

Table 1.2 shows part of the standard ASCII code table (only the control codes have been removed).
表 1.2 显示了标准 ASCII 码表的一部分(只删除了控制代码)。
Table 1.2 Part of the ASCII code table
表 1.2 部分 ASCII 码表
Dec 12 月 Hex 六角形 Char Dec 12 月 Hex 六角形 Char Dec 12 月 Hex 六角形 Char
32 20 <SPACE> 64 40 a 96 60
33 21 ! 65 41 A 97 61 a
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
39 27 *\cdot 71 47 G 103 67 g
40 28 1 72 48 H 104 68 h
41 29 1 73 49 I 105 69 i
42 2 A * 74 4A J 106 6 A j
43 2B + 75 4B K 107 6B k
44 2 C , 76 4 C L 108 6 C l
45 2D - 77 4D M 109 6D m
46 2E 78 4E N 110 6 E n
47 2 F 1 79 4F 0 111 6 F 0
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 3 A : 90 5A Z 122 7A z
59 3B ; 91 5B [ 123 7B {
60 3C < < << 92 5C 1 124 7 C 7 C 7C7 C 1
61 3D = = == 93 5D ] 125 7D }
62 3 E > > >> 94 5E ^ 126 7E
63 3 F 3 F 3F3 F ? 95 5F _ 127 7F <DELETE>
Dec Hex Char Dec Hex Char Dec Hex Char 32 20 <SPACE> 64 40 a 96 60 ・ 33 21 ! 65 41 A 97 61 a 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 39 27 * 71 47 G 103 67 g 40 28 1 72 48 H 104 68 h 41 29 1 73 49 I 105 69 i 42 2 A * 74 4A J 106 6 A j 43 2B + 75 4B K 107 6B k 44 2 C , 76 4 C L 108 6 C l 45 2D - 77 4D M 109 6D m 46 2E 78 4E N 110 6 E n 47 2 F 1 79 4F 0 111 6 F 0 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 3 A : 90 5A Z 122 7A z 59 3B ; 91 5B [ 123 7B { 60 3C < 92 5C 1 124 7C 1 61 3D = 93 5D ] 125 7D } 62 3 E > 94 5E ^ 126 7E 63 3F ? 95 5F _ 127 7F <DELETE>| Dec | Hex | Char | Dec | Hex | Char | Dec | Hex | Char | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 32 | 20 | <SPACE> | 64 | 40 | a | 96 | 60 | ・ | | 33 | 21 | ! | 65 | 41 | A | 97 | 61 | a | | 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 | | 39 | 27 | $\cdot$ | 71 | 47 | G | 103 | 67 | g | | 40 | 28 | 1 | 72 | 48 | H | 104 | 68 | h | | 41 | 29 | 1 | 73 | 49 | I | 105 | 69 | i | | 42 | 2 A | * | 74 | 4A | J | 106 | 6 A | j | | 43 | 2B | + | 75 | 4B | K | 107 | 6B | k | | 44 | 2 C | , | 76 | 4 C | L | 108 | 6 C | l | | 45 | 2D | - | 77 | 4D | M | 109 | 6D | m | | 46 | 2E | | 78 | 4E | N | 110 | 6 E | n | | 47 | 2 F | 1 | 79 | 4F | 0 | 111 | 6 F | 0 | | 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 | 3 A | : | 90 | 5A | Z | 122 | 7A | z | | 59 | 3B | ; | 91 | 5B | [ | 123 | 7B | { | | 60 | 3C | $<$ | 92 | 5C | 1 | 124 | $7 C$ | 1 | | 61 | 3D | $=$ | 93 | 5D | ] | 125 | 7D | } | | 62 | 3 E | $>$ | 94 | 5E | ^ | 126 | 7E | | | 63 | $3 F$ | ? | 95 | 5F | _ | 127 | 7F | <DELETE> |
Consider the uppercase and lowercase codes in binary of characters. 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) 79 号(小写)
' Y Y YY ' ' Y Y YY ' 1 0 1 1 0 0 1 hex 59 (upper case) 六角59(大写)
'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 (upper case)| '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 (upper case) |
The above examples show that the sixth bit changes from 1 to 0 when comparing the lowercase and uppercase of a character. This makes the conversion between the two an easy operation. It is also noticeable that the character sets (e.g. a to z, 0 to 9 , etc.) are grouped together in sequence, which speeds up usability.
上述示例表明,在比较字符的小写和大写时,第六位会从 1 变为 0。这使得两者之间的转换操作非常简单。此外,字符集(如 a 至 z、0 至 9 等)按顺序分组也很明显,这加快了可用性。

Extended ASCII uses 8-bit codes ( 0 to 255 in denary or 0 to FF in hexadecimal). This gives another 128 codes to allow for characters in non-English alphabets and for some graphical characters to be included:
扩展 ASCII 使用 8 位编码(0 至 255(十进制)或 0 至 FF(十六进制))。这就提供了另外 128 个编码,允许使用非英语字母字符和一些图形字符:
DOS WIN Dec 12 月 Hex 六角形 DOS WIN Dec 12 月 Hex 六角形 DOS WIN Dec 12 月 Hex 六角形 DOS WIN Dec 12 月 Hex 六角形
C 128 80 á 160 A0 L À 192 C0 α α alpha\alpha à 224 E0
ü 129 81 if 如果 i 161 A1 _|_\perp Á 193 C1 B á 225 E1
é , 130 82 ó & 162 A2 T Â 194 C2 Γ Γ Gamma\Gamma â 226 E2
â f 131 83 ú £ 163 A3 + Ã 195 C3 π π pi\pi a 227 E3
ä " 132 84 ñ a 164 A4 - Å 196 C4 Σ Σ Sigma\Sigma ä 228 E4
à ... 133 85 Ñ >=\geq 165 A5 + A 197 C5 σ σ sigma\sigma å 229 E5
å \dagger 134 86 a I 166 A6 F E 198 C6 μ μ mu\mu æ 230 E6
& t 135 87 - § 167 A7 II C 199 C7 τ τ tau\tau §̧ 231 E7
ê , 136 88 i - 168 A8 L E 200 C8 Φ Φ Phi\Phi è 232 E8
er % 137 89 - (c) 169 A9 IT É 201 C9 Θ Θ Theta\Theta é 233 E9
è S 138 8A - a 170 AA
E 202 CA Ω Ω Omega\Omega ê 234 EA
1 < 139 8B 1 / 2 1 / 2 1//21 / 2 * 171 A B A B ABA B T Ë 203 CB δ δ delta\delta 235 EB
î (E 140 8C 1 / 4 1 / 4 1//41 / 4 172 A C A C ACA C Is  I 204 CC oo\infty ì 236 EC
i 141 8D i - 173 AD = = == Í 205 CD O/\varnothing i 237 ED
Ä Ž 142 8E « (1) 174 AE $15 Î 206 CE ε ε epsi\varepsilon î 238 EE
A 143 8 F * - 175 AF _|_\perp Ï 207 CF n ï 239 EF
É 144 90 - 176 B0 ® Ð 208 D0 0 240 F0
æ 145 91 ± ± +-\pm 177 B1 N 209 D1 ± ± +-\pm กี 241 F1
E , 146 92 2 178 B2 π π pi\pi ò 210 D2 >=\geq ò 242 F2
ô " 147 93 1 3 3 ^(3){ }^{3} 179 B3 u ó 211 D3 <=\leq 6 243 F3
ö " 148 94 - , 180 B4 t ô 212 D4 1 ô 244 F4
ò *\cdot 149 95 = = == μ μ mu\mu 181 B5 F Õ 213 D5 J 0 245 F5
u - 150 96 - \ 182 B6 π π pi\pi Ö 214 D6 ö 246 F6
ù 151 97 π π pi\pi . 183 B7 H * 215 D7 ~~\approx ÷ ÷ -:\div 247 F7
y 152 98 7 , 184 B8 !=\neq O/\varnothing 216 D8 ^(@){ }^{\circ} 248 F8
Ö TM 153 99 H 1 185 B9 Ư 217 D9 ù 249 F9
Ü § 154 9A || 186 BA r Ú 218 DA ú 250 FA
& , 155 9B 7 " 187 BB Û 219 DB \checkmark a a aa 251 FB
£ prop\propto 156 9 1 / 4 1 / 4 1//41 / 4 188 BC - Ü 220 DC ^(**){ }^{*} ü 252 FC
\ 157 9D \Perp 1 / 2 1 / 2 1//21 / 2 189 BD Ý 221 DD 2 y 253 FD
Pts  z 158 9E a 3 / 4 3 / 4 3//43 / 4 190 BE I p 222 DE - p 254 FE
f Ÿ 159 9F 7 6 191 BF B 223 DF y 255 FF
DOS WIN Dec Hex DOS WIN Dec Hex DOS WIN Dec Hex DOS WIN Dec Hex C € 128 80 á 160 A0 L À 192 C0 alpha à 224 E0 ü 129 81 if i 161 A1 _|_ Á 193 C1 B á 225 E1 é , 130 82 ó & 162 A2 T Â 194 C2 Gamma â 226 E2 â f 131 83 ú £ 163 A3 + Ã 195 C3 pi a 227 E3 ä " 132 84 ñ a 164 A4 - Å 196 C4 Sigma ä 228 E4 à ... 133 85 Ñ >= 165 A5 + A 197 C5 sigma å 229 E5 å † 134 86 a I 166 A6 F E 198 C6 mu æ 230 E6 & t 135 87 - § 167 A7 II C 199 C7 tau §̧ 231 E7 ê , 136 88 i - 168 A8 L E 200 C8 Phi è 232 E8 er % 137 89 - (c) 169 A9 IT É 201 C9 Theta é 233 E9 è S 138 8A - a 170 AA https://cdn.mathpix.com/cropped/2024_09_19_8998dbb2ff8f42d9729cg-17.jpg?height=52&width=42&top_left_y=1510&top_left_x=1232 E 202 CA Omega ê 234 EA 1 < 139 8B 1//2 * 171 AB T Ë 203 CB delta e̊ 235 EB î (E 140 8C 1//4 ᄀ 172 AC Is I 204 CC oo ì 236 EC i 141 8D i - 173 AD = Í 205 CD O/ i 237 ED Ä Ž 142 8E « (1) 174 AE $15 Î 206 CE epsi î 238 EE A 143 8 F * - 175 AF _|_ Ï 207 CF n ï 239 EF É 144 90 浽 - 176 B0 ® Ð 208 D0 三 0 240 F0 æ 145 91 亨 +- 177 B1 〒 N 209 D1 +- กี 241 F1 E , 146 92 變 2 178 B2 pi ò 210 D2 >= ò 242 F2 ô " 147 93 1 ^(3) 179 B3 u ó 211 D3 <= 6 243 F3 ö " 148 94 - , 180 B4 t ô 212 D4 1 ô 244 F4 ò * 149 95 = mu 181 B5 F Õ 213 D5 J 0 245 F5 u - 150 96 - \ 182 B6 pi Ö 214 D6 ö 246 F6 ù — 151 97 pi . 183 B7 H * 215 D7 ~~ -: 247 F7 y 152 98 7 , 184 B8 != O/ 216 D8 。 ^(@) 248 F8 Ö TM 153 99 H 1 185 B9 」 Ư 217 D9 ù 249 F9 Ü § 154 9A || 。 186 BA r Ú 218 DA ú 250 FA & , 155 9B 7 " 187 BB Û 219 DB ✓ a 251 FB £ prop 156 9 』 1//4 188 BC - Ü 220 DC ^(**) ü 252 FC \ 157 9D ⫫ 1//2 189 BD Ý 221 DD 2 y 253 FD Pts z 158 9E a 3//4 190 BE I p 222 DE - p 254 FE f Ÿ 159 9F 7 6 191 BF ■ B 223 DF y 255 FF| DOS | WIN | Dec | Hex | DOS | WIN | Dec | Hex | DOS | WIN | Dec | Hex | DOS | WIN | Dec | Hex | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | C | € | 128 | 80 | á | | 160 | A0 | L | À | 192 | C0 | $\alpha$ | à | 224 | E0 | | ü | | 129 | 81 | if | i | 161 | A1 | $\perp$ | Á | 193 | C1 | B | á | 225 | E1 | | é | , | 130 | 82 | ó | & | 162 | A2 | T | Â | 194 | C2 | $\Gamma$ | â | 226 | E2 | | â | f | 131 | 83 | ú | £ | 163 | A3 | + | Ã | 195 | C3 | $\pi$ | a | 227 | E3 | | ä | " | 132 | 84 | ñ | a | 164 | A4 | - | Å | 196 | C4 | $\Sigma$ | ä | 228 | E4 | | à | ... | 133 | 85 | Ñ | $\geq$ | 165 | A5 | + | A | 197 | C5 | $\sigma$ | å | 229 | E5 | | å | $\dagger$ | 134 | 86 | a | I | 166 | A6 | F | E | 198 | C6 | $\mu$ | æ | 230 | E6 | | & | t | 135 | 87 | - | § | 167 | A7 | II | C | 199 | C7 | $\tau$ | §̧ | 231 | E7 | | ê | , | 136 | 88 | i | - | 168 | A8 | L | E | 200 | C8 | $\Phi$ | è | 232 | E8 | | er | % | 137 | 89 | - | (c) | 169 | A9 | IT | É | 201 | C9 | $\Theta$ | é | 233 | E9 | | è | S | 138 | 8A | - | a | 170 | AA | ![](https://cdn.mathpix.com/cropped/2024_09_19_8998dbb2ff8f42d9729cg-17.jpg?height=52&width=42&top_left_y=1510&top_left_x=1232) | E | 202 | CA | $\Omega$ | ê | 234 | EA | | 1 | < | 139 | 8B | $1 / 2$ | * | 171 | $A B$ | T | Ë | 203 | CB | $\delta$ | e̊ | 235 | EB | | î | (E | 140 | 8C | $1 / 4$ | ᄀ | 172 | $A C$ | Is | I | 204 | CC | $\infty$ | ì | 236 | EC | | i | | 141 | 8D | i | - | 173 | AD | $=$ | Í | 205 | CD | $\varnothing$ | i | 237 | ED | | Ä | Ž | 142 | 8E | « | (1) | 174 | AE | $15 | Î | 206 | CE | $\varepsilon$ | î | 238 | EE | | A | | 143 | 8 F | * | - | 175 | AF | $\perp$ | Ï | 207 | CF | n | ï | 239 | EF | | É | | 144 | 90 | 浽 | - | 176 | B0 | ® | Ð | 208 | D0 | 三 | 0 | 240 | F0 | | æ | | 145 | 91 | 亨 | $\pm$ | 177 | B1 | 〒 | N | 209 | D1 | $\pm$ | กี | 241 | F1 | | E | , | 146 | 92 | 變 | 2 | 178 | B2 | $\pi$ | ò | 210 | D2 | $\geq$ | ò | 242 | F2 | | ô | " | 147 | 93 | 1 | ${ }^{3}$ | 179 | B3 | u | ó | 211 | D3 | $\leq$ | 6 | 243 | F3 | | ö | " | 148 | 94 | - | , | 180 | B4 | t | ô | 212 | D4 | 1 | ô | 244 | F4 | | ò | $\cdot$ | 149 | 95 | $=$ | $\mu$ | 181 | B5 | F | Õ | 213 | D5 | J | 0 | 245 | F5 | | u | - | 150 | 96 | - | \ | 182 | B6 | $\pi$ | Ö | 214 | D6 | | ö | 246 | F6 | | ù | — | 151 | 97 | $\pi$ | . | 183 | B7 | H | * | 215 | D7 | $\approx$ | $\div$ | 247 | F7 | | y | | 152 | 98 | 7 | , | 184 | B8 | $\neq$ | $\varnothing$ | 216 | D8 | 。 | ${ }^{\circ}$ | 248 | F8 | | Ö | TM | 153 | 99 | H | 1 | 185 | B9 | 」 | Ư | 217 | D9 | | ù | 249 | F9 | | Ü | § | 154 | 9A | \|| | 。 | 186 | BA | r | Ú | 218 | DA | | ú | 250 | FA | | & | , | 155 | 9B | 7 | " | 187 | BB | | Û | 219 | DB | $\checkmark$ | $a$ | 251 | FB | | £ | $\propto$ | 156 | 9 | 』 | $1 / 4$ | 188 | BC | - | Ü | 220 | DC | ${ }^{*}$ | ü | 252 | FC | | \ | | 157 | 9D | $\Perp$ | $1 / 2$ | 189 | BD | | Ý | 221 | DD | 2 | y | 253 | FD | | Pts | z | 158 | 9E | a | $3 / 4$ | 190 | BE | I | p | 222 | DE | - | p | 254 | FE | | f | Ÿ | 159 | 9F | 7 | 6 | 191 | BF | ■ | B | 223 | DF | | y | 255 | FF |
Figure 1.6 Exten 图 1.6 扩展
ASCII code table ASCII 码表

Find out more 了解更多

DOS appears in the ASCII extended code table. Find out what is meant by DOS and why it needs to have an ASCII code value.
DOS 出现在 ASCII 扩展码表中。了解 DOS 的含义以及它为什么需要一个 ASCII 码值。
ASCII code has a number of disadvantages. The main disadvantage is that it does not represent characters in non-Western languages, for example Chinese characters. As can be seen in Figure 1.6 where DOS and Windows use different characters for some ASCII codes. For this reason, different methods of coding have been developed over the years. One coding system is called Unicode. Unicode can 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 Table 1.2 and Figure 1.6, ASCII uses one byte to represent a character, whereas Unicode will support up to four bytes per character.
ASCII 码有许多缺点。主要缺点是它不能表示非西方语言的字符,例如汉字。如图 1.6 所示,DOS 和 Windows 对某些 ASCII 码使用了不同的字符。因此,多年来人们开发了不同的编码方法。其中一种编码系统称为 Unicode。Unicode 可以代表世界上所有的语言,因此支持全球使用的许多操作系统、搜索引擎和互联网浏览器。Unicode 与标准 ASCII 码有重叠之处,因为前 128 个字符(英文)是相同的,但 Unicode 总共可以支持几千个不同的字符。从表 1.2 和图 1.6 中可以看出,ASCII 码用一个字节表示一个字符,而统一码每个字符最多可支持四个字节。
The Unicode consortium was set up in 1991. Version 1.0 was published with five goals; these were to:
统一码联盟成立于 1991 年。1.0 版的发布有五个目标,即
》 create a universal standard that covered all languages and all writing systems
创建一个涵盖所有语言和书写系统的通用标准

» produce a more efficient coding system than ASCII
"产生了比 ASCII 更有效的编码系统

》 adopt uniform encoding where each character is encoded as 16-bit or 32-bit code
采用统一编码,每个字符均以 16 位或 32 位代码编码

》 create unambiguous encoding where each 16-bit and 32-bit value always represents the same character
创建无歧义的编码,其中每个 16 位和 32 位值始终代表相同的字符

» 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, for example).
"保留部分代码供私人使用,以便用户为自己的字符和符号分配代码(例如,对中文和日文字符集很有用)。
A sample of Unicode characters are shown in Figure 1.7. As can be seen from the figure, characters used in languages such as Russian, Romanian and Croatian can now be represented in a computer).
图 1.7 是 Unicode 字符的示例。从图中可以看出,俄语、罗马尼亚语和克罗地亚语等语言中使用的字符现在都可以用计算机表示)。
0 1 2 3 4 5 6 7 8 9 A B C D E F
DTAD O σ σ sigma^(@)\sigma^{\circ} o P p R 2 2 Σ Σ Sigma\Sigma 1 t T f T U
0180 u 0 U Y Y YY y Z z 3 ε ε epsi\varepsilon Σ Σ Sigma\Sigma z 5 5 5 D
0100 1 1 \dagger ! LJ Lj Ij NJ Nj nj Ă a I
0100 ì 0 ǒ Ŭ ă 0 ü 0 ü 0 û́ 0 ï 2 A ā
01E0 A ¯ A ¯ bar(A)\bar{A} ã E ¯ E ¯ bar(E)\bar{E} x ¯ x ¯ bar(x)\bar{x} G g Ğ g Ǩ k Q 9 ō 9 9 ¯ bar(9)\overline{9} 3 3
01 F 0 01 F 0 01 F001 F 0 j DZ Dz dz Ǵ g H p N ǹ Å á E Ǿ 6
0200 À â A â E ê Ê ê I ì î î Ö
ô ô
0210 it  R คิ Ü ù 0 û $ $ T t 3 3 H h
0220 17 d 8 8 Z z A่ a E ȩ Ō ō O õ Ó ˙ ˙ ^(˙)\dot{ }
0230 O ¯ O ¯ bar(O)\bar{O} ō Y ¯ Y ¯ bar(Y)\bar{Y} y ¯ y ¯ bar(y)\bar{y} l n t J d φ φ varphi\varphi A C c Ł T $
0240 Z ? 2 B U Λ Λ Lambda\Lambda E e f j q q R F Y y y yy
0250 v a o 6 0 - d d 2 2 & 3 3. 3 3 ^(3){ }^{3} j
0260 g 9 G y γ γ gamma\gamma 4 f ¡ i 1 I \dagger t t tt 1 3 u
0270 แI I m) n n n nn N e (E ϕ ϕ phi\phi 1 1 Ł I c r 1
0280 R в § f f 2 int\int 1 H v v A M ^ y
02.90 z z 3 ? § 3 c o.\odot s G 11 11 ^(11){ }^{11} j j jj y L
0240 q ? ? ?? & d ds Δ Δ Delta\Delta 15 to  fi k t w = = ==
0 1 2 3 4 5 6 7 8 9 A B C D E F DTAD O sigma^(@) ๆ o P p R 2 2 Sigma 1 t T f T U 0180 u 0 U Y y Z z 3 epsi Sigma そ z 5 5 5 D 0100 1 1 † ! DŽ Dž dž LJ Lj Ij NJ Nj nj Ă a I 0100 ì 0 ǒ Ŭ ă 0 ü 0 ü 0 û́ 0 ï 2 A ā 01E0 bar(A) ã bar(E) bar(x) G g Ğ g Ǩ k Q 9 ō bar(9) 3 3 01 F0 j DZ Dz dz Ǵ g H p N ǹ Å á E x́ Ǿ 6 0200 À â A â E ê Ê ê I ì î î Ö https://cdn.mathpix.com/cropped/2024_09_19_8998dbb2ff8f42d9729cg-18.jpg?height=34&width=27&top_left_y=1849&top_left_x=1260 ô ô 0210 文 it R คิ Ü ù 0 û $ $ T t 3 3 H h 0220 17 d 8 8 Z z A่ a E ȩ Ō ō O õ Ó ^(˙) 0230 bar(O) ō bar(Y) bar(y) l n t J d varphi A C c Ł T $ 0240 Z ? 2 B U Lambda E e f j q q R F Y y 0250 v a o 6 0 - d d ง 2 2 & 3 3. ^(3) j 0260 g 9 G y gamma 4 f ¡ i 1 I † t 1 3 u 0270 แI m) n n N e (E ๑ phi 1 1 Ł I c r 1 0280 R в § f f 2 int 1 โ H v v A M ^ y 02.90 z z 3 る ? § 3 c o. s อ G ^(11) j y L 0240 q ? & d ds 也 Delta 15 to fi k t w = ข ฯ| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | DTAD | O | $\sigma^{\circ}$ | ๆ | o | P | p | R | 2 | 2 | $\Sigma$ | 1 | t | T | f | T | U | | 0180 | u | 0 | U | $Y$ | y | Z | z | 3 | $\varepsilon$ | $\Sigma$ | そ | z | 5 | 5 | 5 | D | | 0100 | 1 | 1 | $\dagger$ | ! | DŽ | Dž | dž | LJ | Lj | Ij | NJ | Nj | nj | Ă | a | I | | 0100 | ì | 0 | ǒ | Ŭ | ă | 0 | ü | 0 | ü | 0 | û́ | 0 | ï | 2 | A | ā | | 01E0 | $\bar{A}$ | ã | $\bar{E}$ | $\bar{x}$ | G | g | Ğ | g | Ǩ | k | Q | 9 | ō | $\overline{9}$ | 3 | 3 | | $01 F 0$ | j | DZ | Dz | dz | Ǵ | g | H | p | N | ǹ | Å | á | E | x́ | Ǿ | 6 | | 0200 | À | â | A | â | E | ê | Ê | ê | I | ì | î | î | Ö | ![](https://cdn.mathpix.com/cropped/2024_09_19_8998dbb2ff8f42d9729cg-18.jpg?height=34&width=27&top_left_y=1849&top_left_x=1260) | ô | ô | | 0210 | 文 | it | R | คิ | Ü | ù | 0 | û | $ | $ | T | t | 3 | 3 | H | h | | 0220 | 17 | d | 8 | 8 | Z | z | A่ | a | E | ȩ | Ō | ō | O | õ | Ó | $\dot{ }$ | | 0230 | $\bar{O}$ | ō | $\bar{Y}$ | $\bar{y}$ | l | n | t | J | d | $\varphi$ | A | C | c | Ł | T | $ | | 0240 | Z | ? | 2 | B | U | $\Lambda$ | E | e | f | j | q | q | R | F | Y | $y$ | | 0250 | v | a | o | 6 | 0 | - | d | d | ง | 2 | 2 | & | 3 | 3. | ${ }^{3}$ | j | | 0260 | g | 9 | G | y | $\gamma$ | 4 | f | ¡ | i | 1 | I | $\dagger$ | $t$ | 1 | 3 | u | | 0270 | แI | m) | n | $n$ | N | e | (E | ๑ | $\phi$ | 1 | 1 | Ł | I | c | r | 1 | | 0280 | R | в | § | f | f | 2 | $\int$ | 1 | โ | H | v | v | A | M | ^ | y | | 02.90 | z | z | 3 | る | ? | § | 3 | c | $\odot$ | s | อ | G | ${ }^{11}$ | $j$ | y | L | | 0240 | q | $?$ | & | d | ds | 也 | $\Delta$ | 15 | to | fi | k | t | w | $=$ | ข | ฯ |
Figure 1.7 Sample of Unicode characters
图 1.7 统一码字符示例

1.2.2 Representation of sound
1.2.2 声音的表现形式

Soundwaves are vibrations in the air. The human ear senses these vibrations and interprets them as sound.
声波是空气中的振动。人耳能感知这些振动,并将其解释为声音。

Each sound wave has a frequency, wavelength and amplitude. The amplitude specifies the loudness of the sound.
每种声波都有频率、波长和振幅。振幅表示声音的响度。

Figure 1.8 High and low frequency wave signals
图 1.8 高频和低频波信号

Sound waves vary continuously. This means that sound is analogue. Computers cannot work with analogue data, so sound waves need to be sampled in order to be stored in a computer. Sampling means measuring the amplitude of the sound wave. This is done using an analogue to digital converter (ADC).
声波不断变化。这意味着声音是模拟的。计算机无法处理模拟数据,因此需要对声波进行采样才能将其存储到计算机中。采样意味着测量声波的振幅。这需要使用模数转换器(ADC)。

To convert the analogue data to digital, the sound waves are sampled at regular time intervals. The amplitude of the sound cannot be measured precisely, so approximate values are stored.
为了将模拟数据转换为数字数据,需要以固定的时间间隔对声波进行采样。声音的振幅无法精确测量,因此需要存储近似值。
A Figure 1.9 A sound wave being sampled
图 1.9 声波采样

Figure 1.9 shows a sound wave. The x x xx-axis shows the time intervals when the sound was sampled (1 to 21 ), and the y y yy-axis shows the amplitude of the sampled sound to 10 .
图 1.9 显示的是声波。 x x xx 轴表示声音采样的时间间隔(1 至 21), y y yy 轴表示采样声音的振幅(10)。

At time interval 1, the approximate amplitude is 10; at time interval 2, the approximate amplitude is 4 , and so on for all 20 time intervals. Because the amplitude range in Figure 1.9 is 0 to 10, then 4 binary bits can be used to represent each amplitude value (for example, 9 would be represented by the
在时间间隔 1,振幅近似值为 10;在时间间隔 2,振幅近似值为 4,以此类推,共 20 个时间间隔。由于图 1.9 中的振幅范围是 0 至 10,因此可以用 4 个二进制位来表示每个振幅值(例如,9 可以用
See Section 1.3 for a calculation of file sizes. binary value 1001). Increasing the number of possible values used to represent sound amplitude also increases the accuracy of the sampled sound (for example, using a range of 0 to 127 gives a much more accurate representation of the sound sample than using a range of, for example, 0 to 10). The number of bits per sample is known as the sampling resolution (also known as the bit depth). So, in our example, the sampling resolution is 4 bits.
二进制值 1001)。增加用于表示声音振幅的可能值的数量也能提高声音采样的准确性(例如,使用 0 至 127 的范围比使用 0 至 10 的范围更能准确地表示声音采样)。每个采样的比特数称为采样分辨率(也称为比特深度)。因此,在我们的例子中,采样分辨率为 4 位。
Sampling rate is the number of sound samples taken per second. This is measured in hertz (Hz), where 1 Hz means ‘one sample per second’.
采样率是指每秒采集的声音样本数。单位是赫兹(Hz),1 Hz 表示 "每秒采样一次"。

So how is sampling used to record a sound clip?
那么,如何使用采样来录制声音片段呢?

» the amplitude of the sound wave is first determined at set time intervals (the sampling rate)
"首先按照设定的时间间隔(采样率)确定声波的振幅

" this gives an approximate representation of the sound wave
"这给出了声波的近似表示方法

" each sample of the sound wave is then encoded as a series of binary digits.
"然后将每个声波样本编码为一系列二进制数字。

Using a higher sampling rate or larger resolution will result in a more faithful representation of the original sound source. However, the higher the sampling rate and/or sampling resolution, the greater the file size.
使用更高的采样率或更大的分辨率可以更忠实地再现原始音源。不过,采样率和/或采样分辨率越高,文件大小就越大。
Table 1.3 The benefits and drawbacks of using a larger sampling resolution when recording sound
表 1.3 使用较大采样分辨率录制声音的优点和缺点
Benefits 益处 Drawbacks 缺点
larger dynamic range 更大的动态范围 produces larger file size
文件尺寸更大
better sound quality 更好的音质 takes longer to transmit/download music files
传输/下载音乐文件的时间更长
less sound distortion 减少声音失真 requires greater processing power
需要更强的处理能力
Benefits Drawbacks larger dynamic range produces larger file size better sound quality takes longer to transmit/download music files less sound distortion requires greater processing power| Benefits | Drawbacks | | :--- | :--- | | larger dynamic range | produces larger file size | | better sound quality | takes longer to transmit/download music files | | less sound distortion | requires greater processing power |
CDs have a 16-bit sampling resolution and a 44.1 kHz sample rate - that is 44100 samples every second. This gives high-quality sound reproduction.
CD 具有 16 位采样分辨率和 44.1 kHz 采样率,即每秒采样 44100 次。这样就能重现高质量的声音。

1.2.3 Representation of (bitmap) images
1.2.3 表示(位图)图像

Bitmap images are made up of pixels (picture elements); an image is made up of a two-dimensional matrix of pixels. Pixels can take different shapes such as:
位图图像由像素(图片元素)组成;图像由像素的二维矩阵组成。像素可以有不同的形状,例如

Figure 1.10 图 1.10

Each pixel can be represented as a binary number, and so a bitmap image is stored in a computer as a series of binary numbers, so that:
每个像素都可以用二进制数来表示,因此位图图像是以一系列二进制数的形式存储在计算机中的,这样就可以了:

» a black and white image only requires 1 bit per pixel - this means that each pixel can be one of two colours, corresponding to either 1 or 0
"黑白图像每个像素只需要 1 位,这意味着每个像素可以是两种颜色之一,对应 1 或 0

» if each pixel is represented by 2 bits, then each pixel can be one of four colours ( 2 2 = 4 ) 2 2 = 4 (2^(2)=4)\left(2^{2}=4\right), corresponding to 00 , 01 , 10 00 , 01 , 10 00,01,1000,01,10, or 11
"如果每个像素用 2 位表示,那么每个像素可以是 ( 2 2 = 4 ) 2 2 = 4 (2^(2)=4)\left(2^{2}=4\right) 四种颜色之一,对应于 00 , 01 , 10 00 , 01 , 10 00,01,1000,01,10 或 11

》 if each pixel is represented by 3 bits then each pixel can be one of eight colours ( 2 3 = 8 ) 2 3 = 8 (2^(3)=8)\left(2^{3}=8\right), corresponding to 000, 001, 010, 011, 100, 101, 110, 111.
如果每个像素用 3 位表示,那么每个像素可以是八种颜色 ( 2 3 = 8 ) 2 3 = 8 (2^(3)=8)\left(2^{3}=8\right) 中的一种,分别对应于 000、001、010、011、100、101、110、111。
The number of bits used to represent each colour is called the colour depth. An 8 bit colour depth means that each pixel can be one of 256 colours (because
用于表示每种颜色的比特数称为色深。8 位色彩深度意味着每个像素可以是 256 种颜色中的一种(因为

2 8 = 256 2 8 = 256 2^(8)=2562^{8}=256 ). Modern computers have a 24 bit colour depth, which means over 16 million different colours can be represented With x x xx pixels, 2 x 2 x 2^(x)2^{x} colours can be represented as a generalisation. Increasing colour depth also increases the size of the file when storing an image.
2 8 = 256 2 8 = 256 2^(8)=2562^{8}=256 )。现代计算机的色彩深度为 24 位,这意味着可以用 x x xx 像素来表示 1600 多万种不同的颜色,而 2 x 2 x 2^(x)2^{x} 像素则可以表示一般的颜色。增加色彩深度也会增加存储图像时的文件大小。

Image resolution refers to the number of pixels that make up an image; for example, an image could contain 4096 × 3072 4096 × 3072 4096 xx30724096 \times 3072 pixels (12 582912 pixels in total).
图像分辨率是指组成图像的像素数;例如,一幅图像可能包含 4096 × 3072 4096 × 3072 4096 xx30724096 \times 3072 个像素(共 12 582912 个像素)。

The resolution can be varied on many cameras before taking, for example, a digital photograph. Photographs with a lower resolution have less detail than those with a higher resolution. For example, look at Figure 1.11:
例如,在拍摄数码照片之前,许多相机的分辨率都可以改变。分辨率较低的照片比分辨率较高的照片细节较少。例如,请看图 1.11:
A Figure 1.11 Five images of the same car wheel using different resolutions
图 1.11 使用不同分辨率拍摄的同一汽车轮毂的五幅图像

Image ’ A A AA ’ has the highest resolution and ’ E E EE ’ has the lowest resolution. ’ E E EE ’ has become pixelated (‘fuzzy’). This is because there are fewer pixels in ’ E E EE ’ to represent the image.
图像' A A AA '的分辨率最高,' E E EE '的分辨率最低。 E E EE ' 已变得像素化("模糊")。这是因为' E E EE '中用于表示图像的像素较少。

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. A certain amount of reduction in resolution of an image is possible before the loss of quality becomes noticeable.
使用高分辨率图像的主要缺点是文件大小增大。随着图像像素的增加,文件的大小也会增加。这将影响到硬盘等设备可存储的图像数量。这也会影响从互联网下载图像的时间或从设备到设备传输图像的时间。在图像质量明显下降之前,可以降低一定的图像分辨率。

Activity 1.15 活动 1.15

1 Explain each of the following terms:
1 解释下列每个术语:

i colour depth i 颜色深度
ii ASCII code and Extended ASCII code
ii ASCII 码和扩展 ASCII 码

iii Unicode iii 统一码
iv sampling rate iv 采样率
v bitmap image v 位图图像
2 A colour image is made up of red, green and blue colour combinations. 8 bits are used to represent each of the colour components.
2 彩色图像由红、绿、蓝三色组合而成。每种颜色成分用 8 位来表示。

i How many possible variations of red are there?
i 红色有多少种可能的变体?

ii How many possible variations of green are there?
ii 绿色有多少种可能的变体?

iii How many possible variations of blue are there?
iii 蓝色有多少种可能的变化?

iv How many different colours can be made by varying the red, green and blue values?
iv 通过改变红、绿、蓝三色的数值,可以制作出多少种不同的颜色?

3 Describe the effect of increasing resolution and sampling rate on the size of a file being stored in a computer.
3 说明提高分辨率和采样率对计算机中存储文件大小的影响。

1.3 Data storage and file compression
1.3 数据存储和文件压缩

1.3.1 Measurement of data storage
1.3.1 数据存储的测量

A bit is the basic unit of all computing memory storage terms and is either 1 or 0. The word comes from binary digit. The byte is the smallest unit of memory in a computer. 1 byte is 8 bits. A 4-bit number is called a nibble - half a byte.
比特是所有计算机内存存储术语的基本单位,要么是 1,要么是 0。字节是计算机内存的最小单位。1 个字节为 8 位。4 位的数字称为半字节(nibble)。

1 byte of memory wouldn’t allow you to store very much information so memory size is measured in the multiples shown in Table 1.4:
1 字节内存无法存储太多信息,因此内存大小是以表 1.4 所示的倍数来衡量的:
Table 1.4 Memory size using denary values
表 1.4 使用面值的内存大小
Name of memory size 内存大小名称 Equivalent denary value 等值面值
1 kilobyte (1 KB) 1 千字节(1 KB) 1000 bytes 字节数
1 megabyte (1MB) 1 兆字节 (1MB) 1000000 bytes 字节数
1 gigabyte (1GB) 1 千兆字节(1GB) 1000000000 bytes 字节数
1 terabyte (1TB) 1 太字节(1TB) 1000000000000 bytes 字节数
1 petabyte (1PB) 1 PB (1PB) 1000000000000000 bytes 字节数
1 exabyte (1EB) 1 埃字节(1EB) 1000000000000000000 bytes 字节数
Name of memory size Equivalent denary value 1 kilobyte (1 KB) 1000 bytes 1 megabyte (1MB) 1000000 bytes 1 gigabyte (1GB) 1000000000 bytes 1 terabyte (1TB) 1000000000000 bytes 1 petabyte (1PB) 1000000000000000 bytes 1 exabyte (1EB) 1000000000000000000 bytes| Name of memory size | Equivalent denary value | | | :---: | :--- | :--- | | 1 kilobyte (1 KB) | 1000 | bytes | | 1 megabyte (1MB) | 1000000 | bytes | | 1 gigabyte (1GB) | 1000000000 | bytes | | 1 terabyte (1TB) | 1000000000000 | bytes | | 1 petabyte (1PB) | 1000000000000000 | bytes | | 1 exabyte (1EB) | 1000000000000000000 | bytes |
The above system of numbering now only refers to some storage devices but is technically inaccurate. It is based on the SI (base 10) system of units where 1 kilo is equal to 1000.
上述编号系统目前仅适用于某些存储设备,但在技术上并不准确。它基于 SI(基 10)单位制,其中 1 千克等于 1000。

A 1 TB hard disk drive would allow the storage of 1 × 10 12 1 × 10 12 1xx10^(12)1 \times 10^{12} bytes according to this system.
根据该系统,1 TB 的硬盘可存储 1 × 10 12 1 × 10 12 1xx10^(12)1 \times 10^{12} 字节。

However, since memory size is actually measured in terms of powers of 2, another system has been adopted by the IEC (International Electrotechnical Commission) that is based on the binary system (Table 1.5):
不过,由于内存大小实际上是以 2 的幂来衡量的,因此 IEC(国际电工委员会)采用了另一种基于二进制的系统(表 1.5):
Table 1.5 IEC memory size system
表 1.5 IEC 内存大小系统
Name of memory size 内存大小名称 Number of bytes 字节数 Equivalent denary value 等值面值
1 kibibyte ( 1 KiB ) ( 1 KiB ) (1KiB)(1 \mathrm{KiB}) 1 kibyte ( 1 KiB ) ( 1 KiB ) (1KiB)(1 \mathrm{KiB}) 2 10 2 10 2^(10)2^{10} 1024 bytes 字节数
1 mebibyte ( 1 MiB ) ( 1 MiB ) (1MiB)(1 \mathrm{MiB}) 1 兆字节 ( 1 MiB ) ( 1 MiB ) (1MiB)(1 \mathrm{MiB}) 2 20 2 20 2^(20)2^{20} 1048576 bytes 字节数
1 gibibyte ( 1 GiB ) ( 1 GiB ) (1GiB)(1 \mathrm{GiB}) 1 吉字节 ( 1 GiB ) ( 1 GiB ) (1GiB)(1 \mathrm{GiB}) 2 30 2 30 2^(30)2^{30} 1073741824 bytes 字节数
1 tebibyte ( 1 TiB ) ( 1 TiB ) (1TiB)(1 \mathrm{TiB}) 2 40 2 40 2^(40)2^{40} 1099511627776 bytes 字节数
1 pebibyte ( 1 PiB ) ( 1 PiB ) (1PiB)(1 \mathrm{PiB}) 2 50 2 50 2^(50)2^{50} 1125899906842624 bytes 字节数
1 exbibyte ( 1 EiB ) ( 1 EiB ) (1EiB)(1 \mathrm{EiB}) 2 60 2 60 2^(60)2^{60} 1152921504606846976 bytes 字节数
Name of memory size Number of bytes Equivalent denary value 1 kibibyte (1KiB) 2^(10) 1024 bytes 1 mebibyte (1MiB) 2^(20) 1048576 bytes 1 gibibyte (1GiB) 2^(30) 1073741824 bytes 1 tebibyte (1TiB) 2^(40) 1099511627776 bytes 1 pebibyte (1PiB) 2^(50) 1125899906842624 bytes 1 exbibyte (1EiB) 2^(60) 1152921504606846976 bytes| Name of memory size | Number of bytes | Equivalent denary value | | | :---: | :---: | :--- | :--- | | 1 kibibyte $(1 \mathrm{KiB})$ | $2^{10}$ | 1024 | bytes | | 1 mebibyte $(1 \mathrm{MiB})$ | $2^{20}$ | 1048576 | bytes | | 1 gibibyte $(1 \mathrm{GiB})$ | $2^{30}$ | 1073741824 | bytes | | 1 tebibyte $(1 \mathrm{TiB})$ | $2^{40}$ | 1099511627776 | bytes | | 1 pebibyte $(1 \mathrm{PiB})$ | $2^{50}$ | 1125899906842624 | bytes | | 1 exbibyte $(1 \mathrm{EiB})$ | $2^{60}$ | 1152921504606846976 | bytes |
Advice 建议
Only the IEC system is covered in the syllabus.
教学大纲只涉及 IEC 系统。

This system is more accurate. Internal memories (such as RAM and ROM) should be measured using the IEC system. A 64 GiB RAM could, therefore, store 64 × 2 30 64 × 2 30 64 xx2^(30)64 \times 2^{30} bytes of data ( 68719476736 bytes).
该系统更为精确。内部存储器(如 RAM 和 ROM)应使用 IEC 系统进行测量。因此,64 GiB RAM 可以存储 64 × 2 30 64 × 2 30 64 xx2^(30)64 \times 2^{30} 字节的数据(68719476736 字节)。

1.3.2 Calculation of file size
1.3.2 文件大小的计算

In this section we will look at the calculation of the file size required to hold a bitmap image and a sound sample.
在本节中,我们将研究如何计算保存位图图像和声音样本所需的文件大小。

The file size of an image is calculated as:
图像文件大小的计算公式为

image resolution (in pixels) × × xx\times colour depth (in bits)
图像分辨率(单位:像素) × × xx\times 颜色深度(单位:比特)

The size of a mono sound file is calculated as:
单声道声音文件的大小计算公式为

sample rate (in Hz ) × × xx\times sample resolution (in bits) × × xx\times length of sample (in seconds)
采样率(单位:赫兹) × × xx\times 采样分辨率(单位:比特) × × xx\times 采样长度(单位:秒)

For a stereo sound file, you would then multiply the result by two.
如果是立体声文件,则将结果乘以 2。

? Example 1 ?示例 1

A photograph is 1024 × 1080 1024 × 1080 1024 xx10801024 \times 1080 pixels and uses a colour depth of 32 bits. How many photographs of this size would fit onto a memory stick of 64 GiB ?
一张照片的像素为 1024 × 1080 1024 × 1080 1024 xx10801024 \times 1080 ,色深为 32 位。在 64 GiB 的记忆棒上能放多少张这样大小的照片?

1 Multiply number of pixels in vertical and horizontal directions to find total number of pixels = ( 1024 × 1080 ) = 1105920 = ( 1024 × 1080 ) = 1105920 =(1024 xx1080)=1105920=(1024 \times 1080)=1105920 pixels
1 将垂直和水平方向的像素数相乘,得出像素总数 = ( 1024 × 1080 ) = 1105920 = ( 1024 × 1080 ) = 1105920 =(1024 xx1080)=1105920=(1024 \times 1080)=1105920 像素

2 Now multiply number of pixels by colour depth then divide by 8 to give the number of bytes = 1105920 × 32 = 35389440 / 8 = 1105920 × 32 = 35389440 / 8 =1105920 xx32=35389440//8=1105920 \times 32=35389440 / 8 bytes = 4423680 = 4423680 =4423680=4423680 bytes
2 现在用像素数乘以颜色深度,再除以 8,得出字节数 = 1105920 × 32 = 35389440 / 8 = 1105920 × 32 = 35389440 / 8 =1105920 xx32=35389440//8=1105920 \times 32=35389440 / 8 字节 = 4423680 = 4423680 =4423680=4423680 字节

364 GiB = 64 × 1024 × 1024 × 1024 = 68719476736 364 GiB = 64 × 1024 × 1024 × 1024 = 68719476736 364GiB=64 xx1024 xx1024 xx1024=68719476736364 \mathrm{GiB}=64 \times 1024 \times 1024 \times 1024=68719476736 bytes  364 GiB = 64 × 1024 × 1024 × 1024 = 68719476736 364 GiB = 64 × 1024 × 1024 × 1024 = 68719476736 364GiB=64 xx1024 xx1024 xx1024=68719476736364 \mathrm{GiB}=64 \times 1024 \times 1024 \times 1024=68719476736 字节
4 Finally divide the memory stick size by the files size = 68719476736 / 4423680 = 68719476736 / 4423680 =68719476736//4423680=68719476736 / 4423680 = 15534 = 15534 =15534=15534 photos.
4 最后用记忆棒大小除以文件大小 = 68719476736 / 4423680 = 68719476736 / 4423680 =68719476736//4423680=68719476736 / 4423680 = 15534 = 15534 =15534=15534 照片。

2 Example 2 2 示例 2

A camera detector has an array of 2048 by 2048 pixels and uses a colour depth of 16 . Find the size of an image taken by this camera in MiB.
一台照相机检测器的像素阵列为 2048 x 2048,色深为 16。请计算该相机拍摄的图像的大小(MB)。

1 Multiply number of pixels in vertical and horizontal directions to find total number of pixels = ( 2048 × 2048 ) = 4194304 = ( 2048 × 2048 ) = 4194304 =(2048 xx2048)=4194304=(2048 \times 2048)=4194304 pixels
1 将垂直和水平方向的像素数相乘,得出像素总数 = ( 2048 × 2048 ) = 4194304 = ( 2048 × 2048 ) = 4194304 =(2048 xx2048)=4194304=(2048 \times 2048)=4194304 像素

2 Now multiply number of pixels by colour depth = 4194304 × 16 = 67108864 = 4194304 × 16 = 67108864 =4194304 xx16=67108864=4194304 \times 16=67108864 bits
2 现在用像素数乘以颜色深度 = 4194304 × 16 = 67108864 = 4194304 × 16 = 67108864 =4194304 xx16=67108864=4194304 \times 16=67108864 位数

3 Now divide number of bits by 8 to find the number of bytes in the file = ( 67108864 ) / 8 = 8388608 = ( 67108864 ) / 8 = 8388608 =(67108864)//8=8388608=(67108864) / 8=8388608 bytes
3 现在用比特数除以 8,得出文件 = ( 67108864 ) / 8 = 8388608 = ( 67108864 ) / 8 = 8388608 =(67108864)//8=8388608=(67108864) / 8=8388608 字节的字节数。

4 Now divide by 1024 × 1024 1024 × 1024 1024 xx10241024 \times 1024 to convert to MiB = ( 8388608 ) / ( 1048576 ) = 8 MiB MiB = ( 8388608 ) / ( 1048576 ) = 8 MiB MiB=(8388608)//(1048576)=8MiB\mathrm{MiB}=(8388608) /(1048576)=8 \mathrm{MiB}.
4 现在除以 1024 × 1024 1024 × 1024 1024 xx10241024 \times 1024 ,转换为 MiB = ( 8388608 ) / ( 1048576 ) = 8 MiB MiB = ( 8388608 ) / ( 1048576 ) = 8 MiB MiB=(8388608)//(1048576)=8MiB\mathrm{MiB}=(8388608) /(1048576)=8 \mathrm{MiB}

? ? ?? Example 3  ? ? ?? 例 3

An audio CD has a sample rate of 44100 and a sample resolution of 16 bits. The music being sampled uses two channels to allow for stereo recording. Calculate the file size for a 60 -minute recording.
音频 CD 的采样率为 44100,采样分辨率为 16 位。正在采样的音乐使用两个声道进行立体声录音。计算 60 分钟录音的文件大小。

1 Size of file = = ==
1 文件大小 = = ==

sample rate (in Hz ) × × xx\times sample resolution (in bits) × × xx\times length of sample (in seconds)
采样率(单位:赫兹) × × xx\times 采样分辨率(单位:比特) × × xx\times 采样长度(单位:秒)

2 Size of sample = ( 44100 × 16 × ( 60 × 60 ) ) = 2540160000 = ( 44100 × 16 × ( 60 × 60 ) ) = 2540160000 =(44100 xx16 xx(60 xx60))=2540160000=(44100 \times 16 \times(60 \times 60))=2540160000 bits
2 采样 = ( 44100 × 16 × ( 60 × 60 ) ) = 2540160000 = ( 44100 × 16 × ( 60 × 60 ) ) = 2540160000 =(44100 xx16 xx(60 xx60))=2540160000=(44100 \times 16 \times(60 \times 60))=2540160000 位的大小

3 Multiply by 2 since there are two channels being used = 5080320000 = 5080320000 =5080320000=5080320000 bits
3 乘以 2,因为使用了两个通道 = 5080320000 = 5080320000 =5080320000=5080320000

4 Divide by 8 to find number of bytes = ( 5080320000 ) / 8 = 635040000 = ( 5080320000 ) / 8 = 635040000 =(5080320000)//8=635040000=(5080320000) / 8=635040000
4 除以 8 得出 = ( 5080320000 ) / 8 = 635040000 = ( 5080320000 ) / 8 = 635040000 =(5080320000)//8=635040000=(5080320000) / 8=635040000 字节数

5 Divide by 1024 × 1024 1024 × 1024 1024 xx10241024 \times 1024 to convert to MiB = 635040000 / 1048576 = 605 MiB MiB = 635040000 / 1048576 = 605 MiB MiB=635040000//1048576=605MiB\mathrm{MiB}=635040000 / 1048576=605 \mathrm{MiB}.
5 除以 1024 × 1024 1024 × 1024 1024 xx10241024 \times 1024 ,转换为 MiB = 635040000 / 1048576 = 605 MiB MiB = 635040000 / 1048576 = 605 MiB MiB=635040000//1048576=605MiB\mathrm{MiB}=635040000 / 1048576=605 \mathrm{MiB}

Activity 1.16 活动 1.16
1 A camera detector has an array of 1920 by 1536 pixels. A colour depth of 16 bits
1 相机探测器的像素阵列为 1920 x 1536。色彩深度为 16 位

is used. Calculate the size of a photograph taken by this camera, giving your
使用。计算该相机拍摄的照片的尺寸,并给出您的

answer in MiB. 答案(MB)。
2 Photographs have been taken by a smartphone which uses a detector with a
2 照片是由智能手机拍摄的,该手机使用了一个带有

1024 × 1536 pixel array. The software uses a colour depth of 24 bits. How many
1024 × 1536 像素阵列。软件使用 24 位色深。有多少

photographs could be stored on a 16 GiB memory card?
16GB 存储卡可以存储照片吗?

3 Audio is being sampled at the rate of 44.1 kHz using 8 bits. Two channels are
3 音频采样率为 44.1 kHz,采样位数为 8 位。两个通道为

being used. Calculate: 正在使用。计算:
a the size of a one second sample, in bits
a 一秒钟采样的大小,以比特为单位

b the size of a 30 -second audio recording in MiB.
b 以 MiB 为单位的 30 秒录音大小。

4 The typical song stored on a music CD is 3 minutes and 30 seconds. Assuming
4 音乐 CD 上存储的歌曲一般为 3 分 30 秒。假设

each song is sampled at 44.1 kHz ( 44100 samples per second) and 16 bits are
每首歌的采样率为 44.1 kHz(每秒 44100 个采样点),16 位

used per sample. Each song utilises two channels.
每个采样使用每首歌曲使用两个通道。

Calculate how many typical songs could be stored on a 740 MiB CD.
计算一张 740 MiB 的光盘可存储多少首歌曲。

Activity 1.16 活动 1.16

1 A camera detector has an array of 1920 by 1536 pixels. A colour depth of 16 bits is used. Calculate the size of a photograph taken by this camera, giving your answer in MiB.
1 相机探测器的像素阵列为 1920 x 1536。色彩深度为 16 位。请计算该照相机拍摄的照片的大小,以 MiB 为单位给出答案。

2 Photographs have been taken by a smartphone which uses a detector with a 1024 × 1536 1024 × 1536 1024 xx15361024 \times 1536 pixel array. The software uses a colour depth of 24 bits. How many photographs could be stored on a 16 GiB memory card?
2 照片是由智能手机拍摄的,该手机使用了一个具有 1024 × 1536 1024 × 1536 1024 xx15361024 \times 1536 像素阵列的探测器。软件使用 24 位色深。一张 16GB 的存储卡可以存储多少张照片?

3 Audio is being sampled at the rate of 44.1 kHz using 8 bits. Two channels are being used. Calculate:
3 音频采样率为 44.1 kHz,使用 8 位。使用两个声道。计算:

a the size of a one second sample, in bits
a 一秒钟采样的大小,以比特为单位

b the size of a 30 -second audio recording in MiB.
b 以 MiB 为单位的 30 秒录音大小。

4 The typical song stored on a music CD is 3 minutes and 30 seconds. Assuming each song is sampled at 44.1 kHz ( 44100 samples per second) and 16 bits are used per sample. Each song utilises two channels.
4 音乐 CD 上存储的歌曲一般为 3 分 30 秒。假设每首歌曲的采样频率为 44.1 kHz(每秒采样 44100 次),每个采样使用 16 比特。每首歌曲使用两个通道。

Calculate how many typical songs could be stored on a 740 MiB C D 740 MiB C D 740MiBCD740 \mathrm{MiB} C D.
计算 740 MiB C D 740 MiB C D 740MiBCD740 \mathrm{MiB} C D 上可存储多少首典型歌曲。

1.3.3 Data compression 1.3.3 数据压缩

The calculations in Section 1.3 .2 show that sound and image files can be very large. It is therefore necessary to reduce (or compress) the size of a file for the following reasons:
第 1.3.2 节中的计算表明,声音和图像文件可能非常大。因此,出于以下原因,有必要减小(或压缩)文件大小:

» to save storage space on devices such as the hard disk drive/solid state drive
"节省硬盘/固态硬盘等设备的存储空间

\gg to reduce the time taken to stream a music or video file
\gg 减少流式传输音乐或视频文件所需的时间

» to reduce the time taken to upload, download or transfer a file across a network
"缩短在网络上上传、下载或传输文件的时间

» the download/upload process uses up network bandwidth - this is the maximum rate of transfer of data across a network, measured in bits per second. This occurs whenever a file is downloaded, for example, from a server. Compressed files contain fewer bits of data than uncompressed files and therefore use less bandwidth, which results in a faster data transfer rate.
"下载/上传过程会占用网络带宽--这是网络数据传输的最大速率,以每秒比特为单位。例如,从服务器下载文件时就会出现这种情况。与未压缩文件相比,压缩文件包含的数据位更少,因此占用的带宽更少,数据传输速率更快。

» reduced file size also reduces costs. For example, when using cloud storage, the cost is based on the size of the files stored. Also an internet service provider (ISP) may charge a user based on the amount of data downloaded.
"文件大小的减少也会降低成本。例如,在使用云存储时,成本是根据所存储文件的大小来计算的。此外,互联网服务提供商(ISP)可能会根据下载的数据量向用户收费。

1.3.4 Lossy and lossless file compression
1.3.4 有损和无损文件压缩

File compression can either be lossless or lossy.
文件压缩可以是无损压缩,也可以是有损压缩。

Lossy file compression 有损文件压缩

With this technique, the file compression algorithm eliminates unnecessary data from the file. This means the original file cannot be reconstructed once it has been compressed.
利用这种技术,文件压缩算法可以消除文件中不必要的数据。这意味着原始文件一旦被压缩就无法重建。

Lossy file compression results in some loss of detail when compared to the original file. The algorithms used in the lossy technique have to decide which parts of the file need to be retained and which parts can be discarded.
与原始文件相比,有损文件压缩会损失一些细节。有损压缩技术中使用的算法必须决定文件的哪些部分需要保留,哪些部分可以丢弃。

For example, when applying a lossy file compression algorithm to:
例如,在对有损文件压缩算法进行应用时:

» an image, it may reduce the resolution and/or the bit/colour depth
"图像时,可能会降低分辨率和/或位/色深。

» a sound file, it may reduce the sampling rate and/or the resolution.
"声音文件时,可能会降低采样率和/或分辨率。

  1. first write the number as a positive binary value - in this case 67:
    首先将数字写成正二进制值,本例中为 67:

    01000011
    we then invert each binary value, which means swap the 1s and 0s around: 10111100
    然后,我们将每个二进制值反转,也就是将 1 和 0 互换: 10111100

    then add 1 to that number:
    然后在该数字上加 1:

    1
    this gives us the binary for -67 :
    由此得出 -67 的二进制数:

    10111101