Unformatted text preview:

Binary number, Bits and ByteSlide 2Bits & Bytes?Slide 4The Decimal Number SystemLet us start from an arbitrary decimal numberContinue ..Slide 8Slide 9Slide 11Slide 12Slide 13Any other number systems?A generalized ruleSlide 16The fundamental pointBinary vs. DecimalSlide 19You might askSlide 21Why binary?Slide 23How to store?Slide 25How to calculateSlide 27Slide 28The simplest answer isSlide 30Slide 31Slide 32Slide 33What is a feasible number system?BitsHow does it work?Slide 37How you count or add in decimal?Slide 39Slide 40Slide 41decimal to binaryBinary arithmetic operationHow to add two numbers which are not necessarily base 10More binary operationsSlide 46The Hexadecimal SystemHexadecimal <->binarySlide 49Slide 50The Octal SystemSlide 52Slide 53Slide 54A bitBytesWordsWhy are there 8 bits in a byte?One question?Slide 60ASCIISlide 62Slide 63Bytes: ASCIISlide 65Slide 66Slide 67Slide 68Slide 69revisit “char” data typeMore on bookCharacter and integerSlide 73Even larger capacitySome interesting facts about what these various-sized bytes can store:CPU processes binary numberSlide 77ENDBinary number, Bits and ByteSen Zhang•Number systems–Decimal–Binary–Bits–bytes–Hexadecimal–Octal–Numbers conversion among different systems•Ascii codeBits & 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 processor 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 hexadecimal 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, let's first review the well known decimal number system.The Decimal 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 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 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 10^3Continue ..•Another way to express it would be to use the concept of powers of 10. •A specific digit is associated with a specific weight 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 "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 "10^2"•10 to the fourth power is denoted 10^4•Thus, another way to express the previous number is like this: (6 * 10^3) + (3 * 10^2) + (5 * 10^1) + (7 * 10^0) = 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 from 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 or 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 different 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/yearA generalized rule•The following rules apply to base 10 and to any other base 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 system's base.•Computers happen 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 “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.•Considering 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 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 don’t computers use the base-10 decimal system for numbers, counting and arithmetic?•Why not 4 based, 7 based?•Why 2 based?•We know that the computer doesn't have a real brain inside. In fact, it is made up mostly of semiconductor


View Full Document

Oneonta CSCI 116 - Binary number, Bits and Byte

Documents in this Course
Load more
Download Binary number, Bits and Byte
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Binary number, Bits and Byte and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Binary number, Bits and Byte 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?