Binary number, Bits and Byte.ppt
《Binary number, Bits and Byte.ppt》由会员分享,可在线阅读,更多相关《Binary number, Bits and Byte.ppt(78页珍藏版)》请在麦多课文档分享上搜索。
1、Binary number, Bits and Byte,Sen Zhang,Number systems Decimal Binary Bits bytes Hexadecimal Octal Numbers conversion among different systems Ascii code,Bits & Bytes?,Have you ever heard of words bits and bytes? Have you heard of an advertisement that says, “This computer has a 64-bit Pentium IV proc
2、essor with 256 mega-bytes of RAM and 100 giga-bytes of hard disk space.“ Probably the answer is yes, even for a normal computer user, not to mention you, a C+ programmer. As a computer programmer, you should know what bits and bytes are and how to work with numbers expressed in binary and hexadecima
3、l notations.,In this lecture, we will discuss bits and bytes, binary and decimal numbers in detail so that you will gain a fundamental understanding about their meanings, what these systems are and how they work. To help you understand, lets first review the well known decimal number system.,The Dec
4、imal Number System,The decimal system is the base-10 system that we use every day. A number, say 6357, represented in the base-10 system consists of multiple ordered digits. (In other words, digits are normally combined together in groups to create larger numbers.) A digit is a single place that can
5、 hold numerical values between 0 and 9 (10 different values).,Let us start from an arbitrary decimal number,For example, 6,357 has four digits. It is understood that in the number 6,357, the 7 is filling the “1s place,“ while the 5 is filling the 10s place, the 3 is filling the 100s place and the 6
6、is filling the 1,000s place. So you could express 6,357 this way if you want to be explicit: (6 * 1000) + (3 * 100) + (5 * 10) + (7 * 1) = 6000 + 300 + 50 + 7 = 6357,103,Continue ,Another way to express it would be to use the concept of powers of 10. A specific digit is associated with a specific we
7、ight expressed as powers of 10. The first digit (counting from the right) gives 10 to the 0 power, the second digit gives 10 to the 1 power, and so on.,Exponents are a shorthand way to show how many times a number, called the base, is multiplied times itself. A number with an exponent is said to be
8、“raised to the power“ of that exponent. Assuming that we are going to represent the concept of “raised to the power of“ with the “ symbol. “10 squared“ or 10 to the power of 2 is written as “102“ 10 to the fourth power is denoted 104,Thus, another way to express the previous number is like this: (6
9、* 103) + (3 * 102) + (5 * 101) + (7 * 100) = 6000 + 300 + 50 + 7 = 6357,What you can see from this expression is that each digit is a placeholder for the power of the index of that placeholder of base 10, starting from the least significant digit with 10 raised to the power of zero (i.e. counting fr
10、om the rightmost digit).,But why do we human beings use 10 based number system?,The most commonly accepted explanation is that our base-10 number system was adopted by our ancestors most likely because we have 10 fingers. Interestingly enough, maybe that is why digit in English also means a finger o
11、r toe.,We have reasons to ask a question in our minds: “If we happened to evolve to have eight fingers instead, would we probably have a base-8 number system?” The answer is probably YES!,Any other number systems?,The good news about number systems is that it is not the only choice to have 10 differ
12、ent values in a digit. Actually, we can have base-anything number systems from a theoretical point of view. There are many good reasons to use different bases in different situations. For example, 7 days/week, 12 months/year,A generalized rule,The following rules apply to base 10 and to any other ba
13、se number system: The system of base n requires n different symbols or values. The left most digit is the highest-order digit and represents the most significant digit, while the lowest-order digit is the least significant digit. A digit is represented as powers of the systems base.,Computers happen
14、 to operate using the base-2 number system, also known as the binary number system, just like the base-10 number system is known as the decimal number system to human beings.,The fundamental point,Modern computers use binary number system, in which there are only zeros and ones. (Only two symbols) A
15、 “bit” to binary is similar a “digit” to a decimal information. (Again, the easiest way to understand bits is to compare them to something you know: digits.) A bit has a single binary value, either 0 or 1.,Binary vs. Decimal,Binary is a base two system which works just like our decimal system. Consi
16、dering the decimal number system, it has a set of values which range from 0 to 9. The binary number system is base 2 and therefore requires only two digits, 0 and 1.,The fundamental point,Binary representation of numbers and other information is the representation which can be understood by computer
17、 chips and can be saved in memory. It is important to computers because all computer data is ultimately represented by a series of zeros and ones, no matter you realize it or not.,You might ask,Why dont computers use the base-10 decimal system for numbers, counting and arithmetic? Why not 4 based, 7
18、 based? Why 2 based?,We know that the computer doesnt have a real brain inside. In fact, it is made up mostly of semiconductor materials such as silicon. Yet, a computer acts in many ways as if it does have a real brain, because it can store (memorize) data and derive new information (operations) fr
19、om the input data.,Why binary?,These questions can be answered by a series of relevant questions! How to store the values in hardware? How to automatically perform arithmetic operations on numbers? ,The fundamental question is can we find out a physical material to stably maintain n different status
20、?,How to store?,Advancement in material science guarantees that binary status can be represented with no ambiguity. Silicon and many other semiconductor materials can present one of two status at any given time, and can retain a status for a long time. Positive or negative, +5 volt or -5 volt. Think
21、 about 2 status in electronic world, if not One then Zero, very simple to implement in electronic world.,One the other hand, it is difficult, if not impossible, to find out a material to be able to maintain 10 different status stably. Generally speaking, the more status to maintain, the more difficu
22、lt to find out such a material.,How to calculate,Another factor is how to implement proper digital circuits to perform arithmetic and logical operations based on a specific number system. It turns out that the binary system is the preferred way to implement CPUs to do various operations (arithmetic
23、and logical operations). Not any other systems!,You could wire up and build computers that operate in base-10 (assume physically we can find out such kind of material.), but they would be fiendishly expensive right now. On the other hand, base-2 computers are relatively cheap.,Also because there mus
24、t always be at least two symbols for an information processing system to be able to distinguish significances of different values and to manipulate on them, binary is the smallest numbering system that supports definite arithmetic and logic operations.,The simplest answer is,Basically speaking, bina
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- BINARYNUMBER BITSANDBYTEPPT
