《《计算机专业英语》电子教案第3章.ppt》由会员分享,可在线阅读,更多相关《《计算机专业英语》电子教案第3章.ppt(43页珍藏版)》请在三一办公上搜索。
1、Computer English,Chapter 3 Number Systems and Boolean Algebra,计算机专业英语,3-2,Key points:useful terms and definitions of Number system and Boolean AlgbraDifficult points:Conversion of the Number Systems and Boolean Algbra,计算机专业英语,3-3,Requirements:,1.Concepts of Number System and their conversion,2.Boole
2、an Algebra,3.Moores Law,4.科技英语中数学公式的读法,计算机专业英语,3-4,New Words n.八进制alphabet n.字母表fractional adj.分数的,小数的whole number n.整数remainder n.余数significant figure n.有效数字quotient n.商algorithm n.算法complement n.补码,余角carry n.进位,3.1 Number Systems,Abbreviations:Binary-coded hexadecimal(BCH)二进制编码的十六进制,计算机专业英语,3-5,Th
3、e use of the microprocessor requires a working knowledge of binary,decimal,and hexadecimal numbering systems.This section provides a background for those who are unfamiliar with number systems.Conversions between decimal and binary,decimal and hexadecimal,and binary and hexadecimal are described.,3.
4、1 Number Systems,使用微处理器需要掌握二进制、十进制和十六进制数制系统的基本知识,本节为那些不熟悉数制系统的读者提供这方面的背景知识。说明了十进制与二进制之间、十进制与十六进制之间,及二进制与十六进制之间的转换。,计算机专业英语,3-6,Before numbers are converted from one number base to another,the digits of a number system must be understood.Early in our education,we learned that a decimal,or base 10,num
5、ber was constructed with 10 digits:0 through 9.The first digit in any numbering system is always a zero.For example,a base 8(octal)number contains 8 digits:0 through 7;a base 2(binary)number contains 2 digits:0 and 1.,3.1.1 Digits,将数从种数制向另一种数制转换之前,必须了解数的计数系统。在早期教育中,我们已学习了十进制数,或以10为基的数,它由10个数字组成:0到9。
6、任何计数制的第一个数字总是零,这种规则适用于任何其他数制。例如,以8为基的数(八进制)包含8个数字:0到7,而以2为基的数(二进制)包含2个数字:0和 l。,计算机专业英语,3-7,If the base of a number exceeds 10,the additional digits use the letters of the alphabet,beginning with an A,For example,a base 12 number contains 12 digits:0 through 9,followed by A for 10 and B for 11,Note t
7、hat a base 10 number does not contain a 10 digit,just as a base 8 number does net contain an 8 digit.The most common numbering systems used with computers are decimal,binary,and hexadecimal(base 16).(Many years ago octal numbers were popular.)Each system is described and used in this section of the
8、chapter.,3.1.1 Digits,如果基数大于10,其余数字用从A开始的字母表示,例如,以12为基的数包含12个数字,0到9,之后用A代表10,B代表11。注意,以10为基的数不包含数字10,如同以8为基的数不包括数字8一样。计算机中最通用的计数制是十进制、二进制、八进制和十六进制(基为16)。每种计数制都将在本节中进行说明和应用。,计算机专业英语,3-8,Once the digits of a number system are understood,larger numbers are constructed by using positional notation.In gr
9、ade school,we learned that the position to the left of the units position was the tens position,the position to the left of the tens position was the hundreds position,and so forth.(An example is the decimal number 132:This number has 1 hundred,3 tens,and 2 units.)What probably was not learned was t
10、he exponential value of each position:The units position has a weight of 100 or 1;the tens position has weight of 101,or 10;and the hundreds position has a weight of 102,or 100.,3.1.2 Positional Notation,一旦我们理解了计数制的数字后,就可用位计数法构造更大的数值。在小学时我们都学过个位的左边一位是十位,十位左边一位是百位,以此类推(例如十进制数132,这个数字有个百,三个十和两个一)。或许我们
11、没有学过每个位的指数值:个位的权为l00,即1;十位的权为101或10;而百位的权为102或l00。,计算机专业英语,3-9,The exponential powers of the positions are critical for understanding numbers in other numbering systems.The position to the left of the radix(number base)point,called a decimal point only in the decimal system,is always the units posit
12、ion in any number system.For example,the position to the left of the binary point is always 20 or 1;the position to the left of the octal point is 80 or 1.In any case,any number raised to its zero power is always 1,or the units position.,3.1.2 Positional Notation,位的指数幂在理解其他计数制中的数时是个关键。基数小数点,在十进制中称为十
13、进制小数点,其左边的位在任何数制中都是个位。例如,二进制小数点左边的位是20或1。而八进制小数点左边的位是80或1。在任何情况下,任何数的零次幂总是1,或1个单位。,计算机专业英语,3-10,The position to the left of the units position is always the number base raised to the first power;in a decimal system,this is l01,or l0.In a binary system,it is 21,or 2;and in an octal system it is 81,or
14、 8.Therefore,an 11 decimal has a different value from an 11 binary.The 1l decimal is composed of 1 ten plus 1 unit and has a value of 11 units;while the binary number 11 is composed of 1 two plus 1 unit,for a value of 3 decimal units.The 11 octal has a value of 9 units.,3.1.2 Positional Notation,个位左
15、边的位总是基数的1次幂,在十进制系统中是101,或10;在二进制中是21,或2;而在八进制中是81,或8。因此,十进制的11与二进制的11具有不同的数值。十进制11表示个10加上一个1,其值为11;二进制11表示个2加上个1,其值为3;八进制11的值为9。,计算机专业英语,3-11,In the decimal system,positions to the right of the decimal point have negative powers.The first digit to the right of the decimal point has a value of 10-1,o
16、r 0.1.In the binary system,the first digit to the right of the binary point has a value of 2-1,or 0.5.In general,the principles that apply to decimal numbers also apply to numbers in any other number system.,3.1.2 Positional Notation,在十进制系统中,对于十进制小数点右边的位,它的幂为负数。十进制小数点右边第一位数的值为10-1,或0.1。在二进制中,二进制小数点右
17、边第位数的值为2-1或0.5。一般来说,十进制使用的计数法可以用于任何其他数制。,计算机专业英语,3-12,Example 3-1 shows a 110.101 in binary(often written as 110.1012).It also shows the power and weight or value of each digit position.To convert a binary number to decimal,add the weights of each digit to form its decimal equivalent.The 110.1012 is
18、 equivalent to a 6.625 in decimal(4+2+0.5+0.125).Notice that this is the sum of 22(or 4)plus 21(or 2),but 20(or 1)is not added because there are no digits under this position.The fraction part is composed of 2-1(0.5)plus 2-3(or.125),but there is no digit under the 2-2(or.25).,3.1.2 Positional Notati
19、on,例3-1给出了一个二进制数110.101(通常写成110.1012),也给出了这个数每个位的幂、权和值。为了把二进制数转换为十进制,将每位数字的权相加,就得到了它的等效十进制值。二进制110.101等于十进制的6.625(4+2+0.5+0.125)。注意,这个和的整数部分是由22(4)加21(2)构成,之所以没有用20(1)是因为这个位的数为零。小数部分由2-1(0.5),加2-3(0.125)构成,但是没有用2-2(0.25)。,计算机专业英语,3-13,The prior examples have shown that to convert from any number bas
20、e to decimal,determine the weights or values of each position of the number,and then sum the weights to form the decimal equivalent.Suppose that a 125.78 octal is converted to decimal.To accomplish this conversion,first write down the weights of each position of the number.This appears in Example 3-
21、2.The value of 125.78 is 85.875 decimal,or 164 plus 2 8 plus 51 plus 7.125.,3.1.3 Conversion to Decimal,前面的例子说明了将任何其他基数的数转换为十进制数时,十进制数的值取决于该数每个位上的权或值,它们的和就是等效的十进制数值。假定要将125.78(八进制)转换为十进制。为了完成这个转换,首先写出该数每一位数的权,如例3-2所示,125.78的值是十进制的85.875,即1 64+2 8+5 1+7 0.125。,计算机专业英语,3-14,Notice that the weight of t
22、he position to the left of the units position is 8.This is 8 times 1.Then notice that the weight of the next position is 64,or 8 times 8.If another position existed,it would be 64 times 8,or 51 2.To find the weight of the next higher-order position,multiply the weight of the current position by the
23、number base(or 8,in this example).To calculate the weights of position to the right of the radix point,divide by the number base.In the octal system,the position immediately to the fight of the octal point is 1/8,or.125.The next position is.125/8,or.015625,which can also be written as 1/64.,3.1.3 Co
24、nversion to Decimal,注意,该数个位左边那位的权是8(18)。再前一位的权是64(88)。如果存在更前一位,则其权将是512(648)。将当前位的权乘上基数,就可得到更高一位的权(本例中是乘8)。而计算小数点右边那些位的权,需要用基数去除。在八进制中,紧跟八进制小数点右边的那位的权是1/8,即0.125。下一位是0.125/8,即0.015625,也可以写成1/64。,计算机专业英语,3-15,Hexadecimal numbers are often used with computers.A 6A.CH(H for hexadecimal)is illustrated w
25、ith its weights in Example 3-3.The sum of its digits is 106.75,or 106.The whole number part is represented with 616 plus 10(A)1.The fraction part is 12(C)as a numerator and 16(16-1)as the denominator,or 12/16,which is reduced to 3/4.,3.1.3 Conversion to Decimal,计算机经常使用十六进制。例3-2给出了一个十六进制数6A.CH(H表示十六进
26、制),以及它的权。它的各位数值之和是106.75,即106。整数部分用616加10(A)1表示;分数部分用12(C)作为分子,16作为分母(16-1),或表示为12/16,化简得3/4。,计算机专业英语,3-16,Conversions from decimal to other number systems are more difficult to accomplish than conversion to decimal.To convert the whole number portion of a number to decimal,divide by the radix.To co
27、nvert the fractional portion,multiply by the radix.,3.1.4 Conversion From Decimal,由十进制转换成其他进制比由其他进制转换成十进制困难。转换十进制整数部分时,要用基数去除,转换分数部分时,要用基数去乘它们。,计算机专业英语,3-17,Whole Number Conversion from Decimal.To convert a decimal whole number to another number system,divide by the radix and save the remainders as
28、significant digits of the result.An algorithm for this conversion as is follows:1.Divide the decimal number by the radix(number base).2.Save the remainder(first remainder is the least significant digit),3.Repeat steps 1 and 2 until the quotient is zero.,3.1.4 Conversion From Decimal,转换十进制整数部分 将十进制整数
29、转换成其他数制时,要用基数去除,并且保存余数,作为结果的有效数字。这种转换的算法如下:1.用基数除十进制数。2.保存余数(最先得到的余数是最低有效位数字)。3.重复步骤l和2,直到商为零。,计算机专业英语,3-18,Converting from a Decimal Fraction.Conversion from decimal fraction to another number base is accomplished with multiplication by the radix.For example,to convert a decimal fraction into binar
30、y,multiply by 2.After the multiplication,the whole number portion of the result is saved as a significant digit of the result,and the fractional remainder is again multiplied by the radix.When the fraction remainder is zero,multiplication ends.Note that some numbers are never-ending.That is,a zero i
31、s never a remainder.An algorithm for conversion from a decimal fraction is as follows,3.1.4 Conversion From Decimal,转换十进制小数部分 转换10进制小数部分是用基数乘来完成的。例如,要将十进制 小数转换成二进制,要用2乘。乘法之后,乘积的整数部分保存起来作为结果的一个有效位,剩余的小数再用基数2去乘。当剩余的小数部分为0时,乘法结束。有些数可能永远不会结束,即余数总不为0。转换十进制小数部分的算法如下:,计算机专业英语,3-19,1.Multiply the decimal fr
32、action by the radix(number base).2.Save the whole number portion of the result(even if zero)as a digit.Note that the first result is written immediately to the fight of the radix point.3.Repeat steps 1 and 2,using the fractional part of step 2 until the fractional part of step 2 is zero.,3.1.4 Conve
33、rsion From Decimal,1.用基数乘十进制小数。2.保存结果的整数部分(即使是零)作为一位数。注意,第一个得到的结果写在紧挨着小数点的右边。3.用步骤2的小数部分重复步骤l和2,直到步骤2的小数部分是零。,计算机专业英语,3-20,Binary-coded hexadecimal(BCH)is used to represent hexadecimal data in binary code.A binary-coded hexadecimal number is a hexadecimal number written so that each digit is represe
34、nted by a 4-bit binary number.The values for the BCH digits appear in Table 3-1.Hexadecimal numbers are represented in BCH code by converting each digit to BCH code,with a space between each coded digit.,3.1.5 Binary-Coded Hexadecimal,二进制编码的十六进制(BCH)是用二进制编码表示的十六进制数据,二进制编码的十六进制数是将十六进制数的每一位都用4位二进制数表示。
35、表3-1给出了BCH数的值。用BCH表示十六进制数时,将每个十六进制数字都转换成BCH码,并且每个数位之间用空格分开。,计算机专业英语,3-21,The purpose of BCH code is to allow a binary version of a hexadecimal number to be written in a form that can easily be converted between BCH and hexadecimal.Example 3-8 shows a BCH coded number converted back to hexadecimal co
36、de.,3.1.5 Binary-Coded Hexadecimal,BCH码的目的在于能将十六进制数以二进制的形式写出,使BCH与十六进制之间转换很容易。例3-8表示如何将BCH代码数据转换为十六进制码。,计算机专业英语,3-22,At times,data are stored in complement form to represent negative numbers.There are two systems that are used to represent negative data:radix and radix-1 complements.The earliest sys
37、tem was the radix-1 complement,in which each digit of the number is subtracted from the radix-1 to generate the radix-1 complement to represent a negative number.,3.1.6 Complements,有时,数据以补码的形式存储,以便表示负数。有两种表示负数的方式:补码和反码(基数减l的补),最早的方式是反码。为了得到负数的反码表示,用基数-1减去该数的每一个数位上的数字。,计算机专业英语,3-23,Example 3-9 shows
38、how the 8-bit binary number 01001100 is ones(radix-1)complemented to represent it as a negative value.Notice that each digit of the number is subtracted from one to generate the radix-1(ones)complement.In this example,the negative of 01001100 is 10110011.The same technique can be applied to any numb
39、er system,as illustrated in Example 3-10,in which the fifteens(radix-l)complement of a 5CD hexadecimal is computed by subtracting each digit from a fifteen.,3.1.6 Complements,例3-9表示了如何将8位二进制数01001100对l取补(基数减1的补),以便表示成个负数。注意,用1减去该数的每一位数字,以便生成反码。在此例中,01001100的负数是10110011。同样的技术可适用于任何数制。如例3-10所示,十六进制数5C
40、D的反码是从15(基-1)中减去它的每一位数字得到的。,计算机专业英语,3-24,Today,the radix-1 complement is not used by itself;it is used as a step for finding the radix complement.The radix complement is used to represent negative numbers in modern computer systems.(The radix-1 complement was used in the early days of computer techn
41、ology.)The main problem with the radix-1 complement is that a negative or a positive zero exists;in the radix complement system,only a positive zero can exist.,3.1.6 Complements,如今,反码已不单独使用,而作为求补码的一个步骤使用,补码是当代计算机系统表示负数的方法(反码用于早期的计算技术中)。反码的主要问题是它存在负零或者正零,而补码系统中只能存在正零。,计算机专业英语,3-25,To form the radix c
42、omplement,first find the radix-1 complement,and then add a one to the result.Example 3-11 shows how the number 0100 1000 is converted to a negative value by twos(radix)complementing it.,3.1.6 Complements,为得到补码,先求反码,然后将1加到结果上。例3-11表示了如何通过对2(基为2)取补的方式,将数01001000转换成负数。,计算机专业英语,3-26,To prove that a 0100
43、 1000 is the inverse(negative)of a 1011 0111,add the two together to form an 8-digit result.The ninth digit is dropped and the result is zero because a 0l00100 is a positive 72,while a 1011 0111 is a negative 72.The same technique applied to any number system.Example 3-12 shows how the inverse of a
44、345 hexadecimal is found by first fifteens complementing the number,and then by adding one to the result to form the sixteens complement.As before,if the original 3-digit number 345 is added to the inverse of CBB,the result is a 3-digit 000.As before,the fourth bit(carry)is dropped.This proves that
45、345 is the inverse of CBB.,3.1.6 Complements,为验证0100 1000是1011 1000的反(负数),将两者相加得到一个8位结果。去掉第9位数字,结果是零。因为0100 1000是正数72,而1011 0111是负数72。同样的枝术可用于任何数制。例3-12表示如何求十六进制数345的负数,首先求该数15的补,然后将1加到结果上,得到16的补,同前面类似,如把原来的3位数345加上其负数CBB,则结果是3位000,第4位(进位)被丢掉。这证明了345是CBB的反。,计算机专业英语,3-27,The concept of a Boolean alge
46、bra was first proposed by the English mathematician George Boole in 1847.Since that time,Booles original conception has been extensively developed and refined by algebraists and logicians.The relationships among Boolean algebra,set algebra,logic,and binary arithmetic have given Boolean algebras a ce
47、ntral role in the development of electronic digital computers.,3.2 Boolean Algebra,布尔代数的概念最初是由英国数学家George Boole于1847年提出来的,从那时起,代数学家和逻辑学家们更广泛地发展了Boole最初的概念,并使之更加精练。由于布尔代数、集合代数、逻辑学和二进制算术之间的内在联系,使得布尔代数的理论在电子计算机的发展中起到举足轻重的作用。,计算机专业英语,3-28,The most intuitive development of Boolean algebras arises from th
48、e concept of a set algebra.Let S=a,b,c and T=a,b,c,d,e be two sets consisting of three and five elements,respectively.We say that S is a subset of T,since every element of S(namely,a,b,and c)belongs to T.Since T has five elements,there are 25 subsets of T,for we may choose any individual element to
49、be included or omitted from a subset.Note that these 32 subsets include T itself and the empty set,which contains no elements at all.If T contains all elements of concern,it is called the universal set.Given a subset of T,such as S,we may define the complement of S with respect to a universal set T
50、to consist of precisely those elements of T which are not included in the given subset.,3.2 Boolean Algebra,布尔代数最直觉的发展产生于集合代数的概念。设S=a,b,c和T=a,b,c,d,e分别为两个含有三个和五个元素的集合。由于S中的每一个元素(a,b,c)都属于T,所以我们说S是T的一个子集。由于T有五个元素,因而T共有25个子集,这是因为我们可以选择任何一个元素使其包含于某个子集中或从该子集中删除。应该注意到这32个子集中包含T本身和空集(空集即不含任何元素的集合)。如果T包含了所