Sessions 1, 2 and 3 Number Systems

Size: px
Start display at page:

Download "Sessions 1, 2 and 3 Number Systems"

Transcription

1 COMP 1113 Sessions 1, 2 and 3 Number Systems The goal of these three class sessions is to examine ways in which numerical and text information can be both stored in computer memory and how numerical information might be manipulated to simulate common arithmetic operations. In order to learn how it works, it is necessary to introduce some formalism. First, some definitions. A number is a symbol that represents or corresponds to a quantity of things. A number system (or, as some prefer, a numeral system) is a set of symbols and rules for representing a useful range of numbers. A wide variety of number systems have been used by people throughout history. In Canada, we use the decimal system, which we will look at in much more detail below. There is a lot of information available on the internet on historically important number systems. If you re interested, you might start with the site at Many of the number systems used by early civilizations had a distinct symbol for every quantity they might wish to express. As the size of their herds increased, such number systems either became increasingly awkward or less precise (for instance, by using a word meaning many for any quantity larger than some specific quantity). Positional Number Systems In a positional number system, the numerical significance of a symbol depends on where it appears in the representation of the number. Numbers are created by writing down a sequence of symbols (called digits) selected from a fixed set of symbols. The base or radix of the positional number system is the number of symbols in this fixed set. The radix point is a special symbol used to establish the actual position of each digit in the number. Sounds pretty complicated and weird? Read on. Example 1: The Decimal Number System. Our ordinary decimal number system is a positional number system. The base is 10, because we build up all numerical values using 10 basic symbols: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}. In North America, it is common to use the period as the radix point (we call it the decimal point), but in some European countries, it is more common to use the comma as the radix point. Of course, you know how to work with decimal numbers, but you may not have thought about how their properties arise. Think about the counting process. Suppose we have a vast herd of goats to which we would like to attach a number. Before we start counting any of our goats, we would say that as far as we can say, we have 0 goats. Then one-by-one we start counting as our goats walk past in an orderly single-file line. a goat goes by we now have 1 goat another goat goes by we now have 2 goats another goat goes by we now have 3 goats this continues for a bit until we have counted 8 goats then another goat goes by, and so we have 9 goats now another goat comes, but we ve run out of symbols. Since we are working with a positional number system, what is done is we say we have 10 goats we ve gone once through our entire set of symbols (of which there are ten) and we about to start to go David W. Sabo (2014) Number Systems Page 1 of 50

2 through the set again. The number 10 is formed as a sequence of two of our basic symbols. now another goat comes we increment the rightmost digit of our count by 1, so we can say we have 11 goats. The means we have counted 1 ten of goats and 1 more. The 1 on the right is in position 2 and represents numbers of tens of goats. The 1 on the right is in the position of ones, and represents just numbers of individual goats. when we ve counted 19 goats (1 ten of goats and 9 individual goats), the next goat causes us to change our tally to 20 two tens of goats. This process could go on for a long time, but you can see how the basic rules of counting lead to the properties of the positional number system. When we need to increment position 1 but we are at the highest value symbol, what we do is increment the position to its left by 1, and write a 0. Then further counting can increment this digit by one at a time until we run out of symbols, at which point the digit to the left is again incremented by 1, and we write a 0. You know that in the end, decimal numbers look something like: position: digits in position 0 count as individuals or ones or 10 0 = 1 s. digits in position 1 count as tens or 10 1 = 10 s. digits in position 2 count as hundreds or 10 2 = 100 s. digits in position 3 count as thousands or 10 3 = 1000 s. Similarly, the pattern of positional value can extend to the right of the radix point (here, it is the decimal point of course) so that digits in position -1 count as tenths or as 10-1 s. digits in position -2 count as hundredths or as 10-2 s. digits in position -3 count as thousandths or as 10-3 s. Thus, a decimal number such as really represents the sum: 4 x x x x x x x In this way, a very small set of symbols (only ten) can be used to construct representations of an essentially unlimited range of quantities. The quantity represented by each symbol is not known until we know where in the number that symbol appears. So the leftmost 4 in the example represents a quantity of four thousand things. The rightmost 4 represents a quantity of four thousandths of a thing. Same symbol, but different quantities. The properties of decimal numbers are very familiar to you. This means that you know the basic structure of a positional number system. It also means that you have a mental image of the rather abstract concepts introduced in our definition of a positional number system at the beginning of this document. Much of the remainder of this document deals with applying the same principles when a base different from 10 is being used, and in converting the representations of numbers from one base to another. So, from now on, we will write numbers in the following form: d4d3d2d1d0.d-1d-2d-3d-4 followed by a subscript, b, indicating the base. Here the dk are the digits of the number. Page 2 of 50 Number Systems David W. Sabo (2014)

3 Then, the actual quantity represented by the number is Thus Similarly, + d4 x b 4 + d3 x b 3 + d2 x b 2 + d1 x b 1 + d0 + d-1 x b -1 + d2 x b -2 + d3 x b -3 + d4b = 4 x x x x x = 4 x x x x x 7-2 (You can use your calculator to determine that this last number is numerically equivalent to , rounded to twelve significant figures.) Converting to Base 10 (Decimal) Numbers The last example just above illustrates the procedure for converting numbers expressed in some base, b, into the equivalent number in base 10 (the equivalent decimal form). You just apply the basic definition of a positional number system, and then use your calculator (which gives answers in the decimal number system) to get the decimal value you require. Here s one more example: = 3 x x x x x x x x 5-3 = In this case, the conversion from the base 5 number to its base 10 equivalent gives an answer which can be stated exactly in seven significant digits. Often, conversions from some base to base 10 gives results which do not have terminating decimal parts, and illustrated by the base 7 example in the previous section above. Converting Numbers from Base 10 to Other Base Number Systems The process of converting decimal numbers into their equivalent in some other number base is more complicated than the reverse operation illustrated just above. If we restrict consideration to number bases which are whole numbers and greater than 1, then the following principles apply: the whole number part (to the left of the decimal point) converts to the whole number part (to the left of the radix point) of the result the fractional part (the part to the right of the decimal point) converts to the fractional part (the part to the right of the radix point) of the result The conversion of these two parts must be done separately, because they involve different procedures. i) conversion of the whole number part Suppose wish to convert the number to its equivalent in base 5. The procedure is as follows. Carry out successive divisions by 5, recording both the result and the remainder, until the result of 0 is obtained. Here the sequence of operations is: = 446 with remainder = 89 with remainder 1 David W. Sabo (2014) Number Systems Page 3 of 50

4 89 5 = 17 with remainder = 3 with remainder = 0 with remainder 3 Since we ve reached the result of 0, we stop. Now, the digits of this quantity expressed in base 5 is just the remainders, listed in order from bottom to top; that is = (You can use the methods of the previous section to confirm that is indeed equivalent to ). People refer to this procedure of dividing and recording remainders as the modular arithmetic method. It s fairly easy to see how it works. The base 5 equivalent of will have the general form d4d3d2d1d0, where the digits have values to ensure that d0 + d1(5) + d2(5 2 ) + d3(5 3 ) + d4(5 4 ) + = Now, divide both sides by 5: d0 d1 5 d2 5 d3 5 d Every term except the first in the numerator on the left-hand side of this equation is a multiple of 5 because of the way positional numbers are constructed. Thus, we can rewrite this equation as d d1 d25d35 d It is easy to see here that when 2233 is divided by 5, the result will be 446 with a remainder of 3 (since the fraction on the extreme right is the remainder divided by 5). The fraction on the right must equal the fraction on the left, since the rest of the expression on the left is a whole number. Thus, dividing by 5 and determining the remainder has isolated the value of the rightmost digit, d0, of the base 5 form of the number. If we repeat the process with the whole number parts of each side, we get 2 3 d1 d2 5 d3 5 d4 5 d d2 d3 5d When 446 is divided by 5, the remainder is 1, and this must be the value of d1, the second digit of the base 5 version of the number. Thus, each time we divide by 5, the remainder of the result is the next digit of the base 5 version of the number, working from right to left. Example 2: Convert to its equivalent in base 7. Apply the modular arithmetic method, with the divisor being 7 in this case. We get = with remainder = 8893 with remainder = 1270 with remainder = 181 with remainder = 25 with remainder = 3 with remainder 4 Page 4 of 50 Number Systems David W. Sabo (2014)

5 3 7 = 0 with remainder 3 Now, listing the remainders in reverse order (bottom to top in the list above) gives the desired answer: = We can verify this answer by checking that it s positional number system form does give the original decimal value: x x x x x x 7 6 = If you had a bit of trouble determining the remainders in these divisions by 7, note the following trick. If you use your calculator to do the first division in the list above, you get = The fractional part of this number (to the right of the decimal point) must be the remainder divided by 7 (see the patterns of the calculations on the previous pages). Thus remainder so remainder 7 x = That is, the remainder in this step of division is 4. Since remainders are always whole numbers, you need to use only a few digits of the fractional part to get a result from which the value of the remainder is obvious. Example 3: Convert to its equivalent in base 3. If we had a calculator that could do arithmetic with base 5 numbers, we could simply apply the modular arithmetic method straight away to get our answer. However, most calculators only do arithmetic in base 10. So, the strategy here will be to first convert into its decimal equivalent, and then we can use the modular arithmetic method to convert that number into its base 3 form. So = x x x 5 3 = Then = 189 with remainder = 63 with remainder = 21 with remainder = 7 with remainder = 2 with remainder = 0 with remainder 2 Thus, listing these remainders in order from top to bottom, we get = = David W. Sabo (2014) Number Systems Page 5 of 50

6 Example 4: Convert to its equivalent in base 9. This seems like more of the same. If you just plow ahead and do the arithmetic, you may overlook the fact that there is something very seriously wrong with the purported number If this is a base 5 number, then its digits must be selected from the set of just five basic symbols, conventionally {0, 1, 2, 3, and 4}. Hence a base 5 number cannot contain the symbols 7, 6, or even 5. The conversion request cannot be done, because is not a valid base 5 number, and so cannot be converted into a valid number in any other base. ii) conversion of the fractional part Conversion of the fractional part involves successive multiplication by the new base, retaining the whole number parts of the results. For instance, to convert to its equivalent in base 5, we would do the following x 5 = keep the 3, use the in the next stage x 5 = 4.44 keep the 4, use the 0.44 in the next stage 0.44 x 5 = 2.2 keep the 2, use the 0.2 in the next stage 0.2 x 5 = 1.0 keep the 1, there is nothing left to use in the next stage. The process is complete when the successive multiplication by the new base results in a whole number, since there is no fractional part of the result to take to the next stage. Then, the digits of the number in the new base is just the retained digits (listed following the words keep the above) in the order in which they appeared. Thus, = How can we tell that this is correct? The easiest confirmation is by applying the properties of a positional number system: = 3 x x x x 5-4 = = Example 5: Convert to base 7. We just follow the method explained above x 7 = keep the 0, use the in the next stage x 7 = keep the 6, use the in the next stage x 7 = keep the 4, use the in the next stage x 7 = keep the 4, use the in the next stage x 7 = keep the 3, use the in the next stage x 7 = keep the 5, use the in the next stage x 7 = keep the 1, use the in the next stage x 7 = keep the 5, use the in the next stage The fractional part at each step does not seem to be getting any closer to zero over the long run, and this process is showing no signs of terminating. In fact, in all likelihood, it will not terminate. This would mean that the decimal fraction, , does not have a terminating representation as a fraction in base 7. The best we could do in this case is just quote a certain number of digits as an approximation to the equivalent result: Page 6 of 50 Number Systems David W. Sabo (2014)

7 This example demonstrates that fractions which have a finite length representation in one base may not have a finite length representation in another base. In fact, the same thing would happen if you tried to convert the number 0.17 into its base 10 equivalent: 0.17 = 1 x 7-1 = endlessly repeating the six digit sequence So, when converting numbers from one base to another, a finite length whole number part always converts into a finite length whole number part, but the fractional parts may be finitely long in one system but not in another. This turns out to be the source of difficulties when floating point numbers are manipulated by computers (which work with numbers coded in a base 2 system, rather than a base 10 system). iii) conversion of decimal number which has both whole number and fractional parts In this case, as mentioned earlier, we do the whole number part using the modular arithmetic method, and the fractional part using the successive multiplication method, and put the two results together. Example 6: Convert into its equivalent in base 8. Round the fractional part to six digits if necessary. We need to do the whole number part and the fractional part separately. For the whole number part, use the modular arithmetic method: = 7684 with remainder = 960 with remainder = 120 with remainder = 15 with remainder = 1 with remainder = 0 with remainder 1 Therefore = For the fractional part, we use the successive multiplication method, multiplying by 8 each time. To round the fractional part to six digits if necessary, we must calculate until the process stops or until we actually have seven digits to the right of the radix point x 8 = keep the 4, use the in the next stage x 8 = keep the 1, use the in the next stage x 8 = keep the 4, use the in the next stage x 8 = keep the 2, use the in the next stage x 8 = keep the 2, use the in the next stage x 8 = keep the 3, use the in the next stage x 8 = keep the 3, use the in the next stage This is now seven steps with no sign of termination. So far, we have = Since the seventh digit is a 3, which is less than half of 8, we just drop the seventh digit and leave the sixth digit unchanged in order to round off to six places to the right of the radix point. Thus, our final answer here is David W. Sabo (2014) Number Systems Page 7 of 50

8 As a check, we note that: = x x x 8 5 = = verifying our result for the whole number part. For the fractional part, we get = You need to use a computer to get this many decimal places. Although this number is obviously not equal to , you do get , if you round it off to three decimal places, and so our result for the fractional part of the number is verified. The difference between this number and the desired value , is the result of rounding the fractional part of the octal representation to six digits. Names of Number Systems Positional number systems are often given names that reflect the value of their base. The most commonly used names are: base = 2 base = 3 base = 4 base = 5 base = 8 base = 10 base = 16 binary number system ternary number system quaternary number system quinary or quintal number system octal number system decimal number system hexadecimal number system The list above reflects common usage. (These names do not follow a precise grammatical pattern, and you can find internet sites promoting the use of names such as octonary instead of octal or banal instead of binary. ) The most important numbers systems involved in computer systems technology are the binary, octal, decimal and hexadecimal systems. Most of the remainder of this document will deal with just these four systems. Positional Number Systems With Bases Larger than 10 To write numbers in a positional system with base n, we need n symbols to use as digits. When n is 10 or less, it is conventional to simply use the first n symbols from the set that we use for decimal numbers. Thus, base 3 numbers use the symbol set {0, 1, 2}, and base 7 numbers would use the symbol set {0, 1, 2, 3, 4, 5, 6}, and so on. For bases, n, which are bigger than 10, obviously we need additional symbols. The convention is to adopt alphabetic characters, in alphabetic order. Thus, for example, to write numbers in hexadecimal form, we need 16 symbols. The set of symbols conventionally used is Page 8 of 50 Number Systems David W. Sabo (2014)

9 {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F} Thus, the symbol following 9 is A, the one following A is B, and so on. The ten usual numerical symbols along with the first six letters of the alphabet give us the sixteen symbols we need for expressing numbers in a base 16 number system. This means that A16 = 1010 B16 = 1110 C16 = 1210 D16 = 1310 E16 = 1410 F16 = 1510 If you needed to construct numbers with even larger bases, you would just continue to use further alphabetic characters: G, H, I, J, K, etc. Binary and Related Number Systems Having established some basic properties of positional number systems and methods for converting the representation of a number in one system into the equivalent representation in another number system, we can now turn our attention to numbers systems which are of greatest importance in computer technologies. Since digit electronic devices are capable of existing in one of two states, the most fundamental representations of data by computers makes use of the two symbols: {0, 1} a binary or base 2 system. Ultimately, all data representations stored electronically will have to be binary. However, binary representations are not particularly convenient for human beings, nor are humans particularly effective in working with binary numbers. This has led to the use of hexadecimal numbers as a convenient intermediate between the binary form used for digital data storage, and the decimal form we use in everyday communication. Historically, computer technologies have used the octal or base 8 system, and so we will look at that one briefly as well. Binary Numbers In a positional number system with base 2, the two symbols used for digits are conventionally 0 and 1. The positional values of the digits are powers of 2. The first few positions on either side of the radix point have the values: Although this pattern is what we would call a base 2 positional number system using the characteristics of a positional number system as they have been described in previous pages of this document, the application of binary numbers in digital computer design will require some modifications to this basic method. In what follows, we will refer to the above pattern as ordinary unsigned binary. The unsigned part just means we are not making any allowance for the possibility of negative numbers at this stage. The word ordinary distinguishes this type of binary number from other patterns that have been developed to allow for arithmetic operations involving negative numbers. These other ways of rewriting decimal values in binary form will have their own special names. David W. Sabo (2014) Number Systems Page 9 of 50

10 Conversions from binary to decimal are particularly easy in the sense that a digit can only be 0 (in which case there is no contribution to the value from that position in the number) or 1 (in which case, the contribution is just the position value). Thus = = Of course, you can also use the modular arithmetic and/or successive multiplication method for conversion of decimal numbers to their binary equivalent. Example 7: Convert to ordinary unsigned binary form. We proceed here much like we did in the previous example 6, except that now the divisor and multiplier we use is 2 instead of 8. So, using modular arithmetic to convert the whole number part, we get So, we conclude that = 83 with remainder = 41 with remainder = 20 with remainder = 10 with remainder = 5 with remainder = 2 with remainder = 1 with remainder = 0 with remainder = Convert the fractional part by successive multiplications by 2: x 2 = keep the 1, use the in the next stage x 2 = 1.25 keep the 1, use the 0.25 in the next stage x 2 = 0.5 keep the 0, use the 0.5 in the next stage 0.5 x 2 = 1.0 keep the 1 The residual fractional part is now zero, and so we re done with the conversion. The computations mean that = , listing the kept digits in the order in which they arose. Thus, the final answer in this case is: = For decimal numbers with more that two or three digits, there is a more efficient approach with far less chance of error in hand calculations that makes use of hexadecimal numbers. Details are given ahead. Page 10 of 50 Number Systems David W. Sabo (2014)

11 Hexadecimal Numbers Hexadecimal numbers use a positional number system with a base of 16. The sixteen basic symbols forming the digits of hexadecimal numbers are: hexadecimal digit: A B C D E F decimal value: Although people have been known to use the lower case characters {a, b, c, d, e, f} for the last six symbols in this set, it is strongly recommended that you always write these in upper case form as shown in the list above. Conversion from hexadecimal to decimal form is done using the positional values of digits of the number system. Each position has a value different by a factor of 16 in this case compared to the adjacent digits. Example 8: Convert E57AB.C916 to its equivalent decimal number. The problem here is solved by simply applying the positional values of each hexadecimal digit. We ll do this in two steps: writing out the positional value expression as a first step, and then translating the hexadecimal digits as necessary in the second step: 1 1 E57 ABC. 9 B A E16 C Although you can t tell for sure using a calculator that displays just eight digits to the right of the decimal point, the conversion above is exact to eight decimal places. There has been no rounding. (In fact, you can demonstrate that a binary number with n digits to the right of the radix point will convert exactly to a decimal number with no more than n digits to the right of the decimal point. As you ll see below, this means that a hexadecimal number with n digits to the right of the radix point will convert exactly to a decimal number with no more than 4n digits to the right of the decimal point. The unavoidable need for truncation in conversion of fractional parts between decimal, binary, octal, and hexadecimal occurs in conversion of decimal numbers to one of these other three forms, and not when the conversion is the other way around.) Conversion of decimal numbers to hexadecimal form is done using the modular arithmetic/successive multiplication method as usual. Example 9: Convert to its equivalent hexadecimal number. For the whole number part we have = 2035 with remainder 13 = D = 127 with remainder = 7 with remainder 15 = F16 David W. Sabo (2014) Number Systems Page 11 of 50

12 7 16 = 0 with remainder 7 So, = 7F3D16. For the fractional part, we have x 16 = keep the 11 = B16, use the in the next stage x 16 = 6.00 keep the 6 Thus = 0.B616 Thus, finally, = 7F3D.B616. as the required answer. Octal Numbers Octal numbers use a positional number system with a base of 8. The eight basic symbols forming the digits of octal numbers are {0, 1, 2, 3, 4, 5, 6, 7}, each having the same numerical value as the identical decimal digit. Octal numbers are not used as extensively in computer applications any more as they once were, but you will encounter them occasionally in certain areas of application. To convert from octal to decimal forms of a number, just use the positional values of each digit in the usual way. To convert from decimal to octal, use the modular arithmetic and successive multiplication methods in the usual way. Example 10: Convert into its decimal equivalent = Example 11: Convert into its octal equivalent. First, the whole number part: So, = 3441 with remainder = 430 with remainder = 53 with remainder = 6 with remainder = 0 with remainder = Page 12 of 50 Number Systems David W. Sabo (2014)

13 For the fractional part, So, x 8= keep the 3, use the in the next stage x 8= keep the 2, use the in the next stage x 8 = 7.00 keep the = So, the final answer is = Useful Relationships Between Binary, Octal, and Hexadecimal Numbers A binary digit can exist in one of two forms: 0 or 1. This means that two binary digits can exhibit four different patterns or states: either of two possible values in the second digit can be paired up with either of two possible values in the first digit, so that 2 x 2 = 4 different patterns of digits are possible. Extending this argument, three binary digits are capable of exhibiting a total of 8 different patterns each of the two possible values of the third digit can be paired up with any of the four possible patterns that the first two digits can have. In fact, if you think about it, the number of possible patterns of three zeros and ones is exactly equal to the number of rows in a truth table for an expression involving three logical variables. If we tabulate these 8 patterns, and then interpret them as binary numbers, we get the following decimal equivalents: 3-digit binary number decimal equivalent With a three-digit binary number, we can represent the range of values that a single digit of an octal number can display. This means that each digit in an octal number is equivalent to three digits in the corresponding binary form of that number, and each triplet of digits in a binary number (counting from the radix point, either left or right this is important!) is equivalent to one digit in the corresponding octal form of that number. This gives us a quick way to convert from octal to binary forms of numbers (or the reverse). Before exploiting this property of octal and binary numbers, we take a look at an even more useful similar connection between binary and hexadecimal numbers. There are sixteen distinct symbols in the hexadecimal number system, which is exactly the number of distinct patterns of zeros and ones in a group of four binary digits. (Again, think of the number of rows in a truth table for an expression involving four logical variables.) It is easy to confirm the following equivalences: David W. Sabo (2014) Number Systems Page 13 of 50

14 4-digit binary number hexadecimal equivalent A B C D E F The small numbers along the left are just decimal numbers labeling the rows (as we did earlier in the course in labeling rows of 4-variable truth tables). This table demonstrates that each digit in the hexadecimal representation of a number corresponds to four digits in the binary representation of that number, and each group of four digits in the binary representation (counting fours starting at the radix point, either right or left) corresponds to one digit in the hexadecimal representation of that number. This provides a fast way to convert between binary and hexadecimal representations of a number. Example 12: Determine the octal and hexadecimal representation of the binary number Before this section, the strategy we would have to use to accomplish these tasks would be to first convert the binary number to decimal form (a fairly difficult task because of the number of digits in this binary number) and then we could use the modular arithmetic and successive multiplication methods to convert that decimal value to octal and to hexadecimal. In view of the special relationships just described between binary, octal and hexadecimal representations, this task can be done by grouping the binary digits appropriately and translating the groups directly into either octal or hexadecimal digits. To convert to the octal representation, we need to recopy the binary number very carefully and insert separators between each group of 3 digits, counting left and right from the radix point. Then below each group of three, we jot the octal digit equivalent: 1/011/00 0/110/101/0 10/010/100110/100/11 0/101/ You can get these octal digits from the table just above, or just use the fact that in the three digit groupings, the place values are 1, 2, and 4 reading from right to left (eg = = 610 = 68). Notice that the values of triplets at the extreme right and extreme left are worked out as if zeros are added to the outside of them to complete the triplet. Thus, the single 1 on the left is evaluated as if it were a triplet 001, and the single 1 on the extreme right is evaluated as if it were the triplet 100. You know that appending zeros to either the right or left of a decimal number does not change its value, and the same is true for numbers in any base. Page 14 of 50 Number Systems David W. Sabo (2014)

15 So, we can now write: = From the number of digits involved in both numbers, you can easily see that this method is superior to first converting the binary number to decimal, and then the decimal number to octal. A similar procedure is used to obtain the hexadecimal equivalent, only now the original binary number is chopped up into groups of four digits counting from the radix point: 10/1100/ 0110/1010/ 1001/0100/.1101/0011/ 0101/ C 6 A 9 4 D In the first row of translations, we ve written down the decimal equivalent of each group of four digits. Then in the second row, we ve written down the corresponding hexadecimal digits. In this case, the partial groups of four digits on either end are completed by adding zeros to the outside as required. Thus the group 10 on the left end is expanded to 0010, equivalent to 216, and the group 10 on the right is expanded to 1000, equivalent to 816. We always add the extra zeros to the outside of the group. So, we can state = 2C6A94.D35816 There are two important implications of this special relationship that exists between binary, octal and hexadecimal numbers. (i) Digital computers work with binary numbers only, but human beings are very poorly equipped to work reliably with binary numbers because we have trouble parsing long lists of only two different symbols reliably. On the other hand, humans can deal with shorter lists of a larger number of possible symbols very well. (After all, even the dullest of us can handle words of one syllable strings of three or four symbols selected from a set of 26 different symbols.) So, in practice, because there is this simple equivalence between groups of binary digits and either octal or hexadecimal digits, it is common for low-level computer data to be displayed to humans in hexadecimal (and sometimes octal) form. You will see this when we talk about the ASCII code for storing text in computer memory. (ii) We can also use this relationship between binary and hexadecimal numbers to streamline conversions between decimal and binary numbers. Particularly when the decimal number involved has more than two or three digits, or the binary number has more than eight or ten digits, we strongly recommend that conversions between decimal and binary be done using a hexadecimal intermediate. If you do these conversions directly, the number of steps in the calculation will be so great that it is almost impossible to avoid making an error. Example 13: Convert to ordinary unsigned binary form. As usual, the whole number and fractional parts have to be converted using separate methods. If we do the modular arithmetic for the whole number part and the successive multiplication for the fractional part using the base 2, the steps look like: = with remainder x 2 = = with remainder x 2 = David W. Sabo (2014) Number Systems Page 15 of 50

16 = with remainder x 2 = = 5317 with remainder x 2 = = 2658 with remainder x 2 = = 1329 with remainder x 2 = = 664 with remainder = 332 with remainder = 166 with remainder = 83 with remainder = 41 with remainder = 20 with remainder = 10 with remainder = 5 with remainder = 2 with remainder = 1 with remainder = 0 with remainder 1 So, writing the remainders from the modular arithmetic calculation in reverse order, and the whole number parts from the successive multiplication calculation in the order in which they appeared, we get that = If we had used base 16 as an intermediate in this conversion, the calculations would have gone as follows: = 5317 with remainder x 16 = = 332 with remainder x 16 = = 20 with remainder = 1 with remainder = 0 with remainder 1 This means that = 14C59.2C16 using the facts that = = 00012, 416 = 01002, C16 = 11002, 516 = 01012, 916 = 10012, and 216 = We could even have done this conversion through an octal intermediate: = with remainder x 8 = = 1329 with remainder x 8 = = 166 with remainder = 20 with remainder = 2 with remainder = 0 with remainder 2 Then, using the fact that 18 = 0012, 28 = 0102, 38 = 0112, 48 = 1002, and 68 = 1102, Page 16 of 50 Number Systems David W. Sabo (2014)

17 we get = = which is identical (except for leading and trailing zeros) to the previous two results. The point of this example is that the large amount of easily messed up detail present in the eventual binary number is packaged into more humanly manageable chunks by using either a hexadecimal or octal intermediate in the conversion from decimal to binary forms. Addition of Unsigned Binary Numbers In order to understand some of the issues we will address shortly in looking at methods for representing numbers in digital computers, you will need to be able carry out the addition of two unsigned binary numbers by hand. The process is a simple adaptation of the method we use routinely for adding decimal numbers. We would display the work involved in adding to something like: 11 carries We work from right to left here: first, add 4 to 2, write the result 6 in the rightmost position then, add 7 to 8. The result is 15, which is too big to write in one space. The 5 is written in the second column, and the 1 is carried over to the third column, written just above the 2 there. now, add the digits in the third column from the right: = 10. The digit 0 is written down and the 1 is carried to the next column. now add the digits in the fourth column from the right: = 7. This single digit is written down, there is nothing to carry to the next column. finally, add the digits in the last column on the left: = 14. Both are written down since there are no more columns to carry into. The end result is the sum Whenever the sum of digits in a column exceeds 9, the excess (which is just the left-most digit of that column sum) must be carried to the next column leftwards. The same pattern works with unsigned binary numbers. In this case, there are really only five distinct situations we need to take into account: Whenever the result of the addition is two digits, the leftmost digit is carried to the next column leftwards (and should be written down explicitly as carries in this course). Example 14: Add the following two unsigned binary numbers, showing all carries. David W. Sabo (2014) Number Systems Page 17 of 50

18 Confirm your end result by converting all numbers to decimal form and performing the addition. We ll display the addition in the traditional form as a whole, and explain each column in notes to follow: carries result column number The bottom row of italicized digits number the columns from right to left. The work done here is as follows: column 1 has = 10 (binary). Write down the 0 and carry the 1 to the next column. column 2 now has = 112. Write down the 1 on the right, and carry to 1 on the left to the next column. column 3 now has = 102. Write down the 0 and carry the 1 to the next column. column 4 now has = 12. Write down the 1. There is nothing to carry to the next column. column 5 has = 12. Write down the 1. There is nothing to carry to the next column. column 6 has = 102. Write down the 0 and carry the 1 to the next column. column 7 now has = 102. Write down the 0 and carry the 1 to the next column. column 8 now has = 102. Write down the 0 and carry the 1 to the next column. column 9 now has = 102. Write down the 0 and carry the 1 to the next column. column 10 now has = 102. Write down the 0 and carry the 1 to the next column. column 11 now has = 102. Write down the 0 and carry the 1 to the next column. column 12 now has = 112. Since this is the leftmost position of the numbers being added, write down both digits, completing the result. We need to confirm the result using decimal arithmetic. Converting the two original numbers to decimal via a hexadecimal intermediate gives: = B6316 = 11 x x = = CB716 = 12 x x = and for the result of the binary addition = 181A16 = 1 x x x = But, using a calculator, = , and so the binary result is confirmed. Page 18 of 50 Number Systems David W. Sabo (2014)

19 Methods of Representing Numbers in Digital Computing With this theory of number systems behind us, it is now time to address some practical issues as far as devising binary number representations for use in digital computing. Although it is easy to generalize conventions that we use for decimal numbers into written ordinary binary forms, these do not lend themselves to straightforward computer implementation. There are two issues we need to take account of: (i) the distinction between whole numbers (integers) and floating point numbers You have already seen one bothersome distinction between the results of converting whole numbers into binary form and of converting numbers with fractional parts into binary form namely that when a fractional part is present, it may not be possible (in fact, usually is not possible) to express the binary equivalent of the fractional part in a finite number of digits. This means that techniques for coding floating point numbers in a binary form will have to allow for truncation and hence the usual occurrence of inexact conversions. A second problem is that while whole numbers that arise in calculations are often the result of enumeration of actual objects and thus, do not usually have extremely large values, it is not uncommon to have floating point values which range over many, many decimal digit positions. For instance, typical time intervals for a microprocessor operation are of the order of nanoseconds, or seconds. On the other hand, the number of such operations a computer performs in one second is of the order of, say, Since there are approximately seconds in one year, then a typical pc performs about cycles per year. Any capability of manipulating floating point arithmetic by computer will have to be able to cope with values having such widely different orders of magnitude. (ii) distinguishing between positive and negative numbers In ordinary written decimal arithmetic, we distinguish between positive and negative values by appending a minus sign in front of numbers measuring negative values. However, in computer application, we only have two symbols available, 0 and 1, both of which are used for coding the actual numerical value. If we introduced a minus sign, as a distinct symbol, we would suddenly be working with a three-symbol system, and conventional computing equipment cannot handle that. So, we must come up with other ways of distinguishing between positive and negative values. The way we address both of these issues has implications for what will be required in developing algorithms for carrying out arithmetic operations on the binary numbers that result. When we work with decimal numbers on paper, whether whole numbers or numbers with fractional parts, it number of digits in the number is not usually an issue we have to think much about. If we encounter a larger number, we just use up more space on the paper. However, when numbers are stored in a binary form in computer memory, the number of binary digits, or bits, available for each number has to be fixed in advance. The computer hardware is not designed to be able to store different numbers with different numbers of binary digits, because the binary digits are being electronically coded into an array of actual physical memory devices. The principles we will describe below do not require a specific number of bits to be available for each number, but to illustrate them, we will have to assume a specific number of bits. For most of the examples to follow, we will work with 8-bit binary representations for whole numbers. In computer technology, 8 bits of memory is called 1 byte, which is the smallest directly accessible amount of memory on most computers. At the end we ll look very briefly at how easily the patterns established show up in larger numbers, such as 16-bit or 32-bit numbers. (You could also illustrate these binary representations using, say, 5 bit binary numbers or 11-bit binary numbers, or whatever. We ve chosen to use 8-bit binary representations as illustrations here because they are simple enough to prevent hand calculations from becoming really tedious; they are extensive enough to give some variety in the results you see; and there are quite a number of practical situations in which 8-bit binary numbers are used.) David W. Sabo (2014) Number Systems Page 19 of 50

20 We start by describing five commonly-used approaches to coding whole numbers, all but one of which takes sign into account. Computer Representation of Integers (i) (modulo 2 n ) unsigned binary numbers This format is what we ve called ordinary unsigned binary form so far. Numbers are coded in binary form using n bits. When n = 8, the range of values that can be represented is up to = = = a total of 2 8 = 256 different values. (Obviously, in general, the range of decimal numbers represented in n-bit unsigned binary form is 010 to 2 n 1). Conversion from decimal to unsigned binary form is done using the modular arithmetic method, and conversion from unsigned binary to decimal using the positional values of the binary digits, as has been demonstrated earlier in this document. Example 15: Write the following decimal numbers in 8-bit unsigned binary form: 46, 182, -92, and 465. For 4610, we ll use the modular arithmetic method directly, since 46 is quite a small number: 46 2 = 23 with remainder = 11 with remainder = 5 with remainder = 2 with remainder = 1 with remainder = 0 with remainder 1 Listing the remainders in reverse order, we get 4610 = This result is just 6 digits long, so to get the 8-bit form of 4610, we need to pad on the left with two zero digits. Thus, 4610 = in 8-bit unsigned binary form. Since is a somewhat larger value, we ll carry out the conversion to binary form through a hexadecimal intermediate: Thus, = 11 with remainder = 0 with remainder 11 = B = B616 = (where we have used the fact that B16 = 1110 = and 616 = 610 = 01102). Page 20 of 50 Number Systems David W. Sabo (2014)

21 For the remaining two values, we are out of luck is a negative number, but the unsigned binary format is incapable of storing sign information. Hence, cannot be coded in unsigned binary form. Since the largest value expressible in an 8-bit unsigned binary number is = 255, we are unable to code in 8-bit unsigned binary form. (ii) signed magnitude form A very obvious way to include sign information in the binary representation of a number is to use one of the available digits to distinguish between positive an negative values. In the signed magnitude form, the left-most digit is used for this purpose: 0 _ indicates a positive value 1 _ indicates a negative value. The remaining n 1 digits are then used to store the numerical value without sign (the magnitude) in unsigned binary form. Thus, for 8-bit signed magnitude numbers, the largest magnitude we can store is the unsigned binary value , a string of seven 1 s, which is equivalent to So, in 8-bit signed magnitude form, we can store any integer between (= ) and (= ). An oddity of the signed magnitude form is that there are two distinct representations of the number 010: and = = -010 The signed magnitude form is easy to set up, but it turns out to be quite awkward to formulate basic arithmetic operations using the signed magnitude form. The basic idea of using a single bit to distinguish between positive and negative numbers is used in the standard methods of coding floating point numbers. Example 16: Express the decimal values 87, -63, 149, and -738 in 8-bit signed magnitude form. The technique is to start by converting the numerical part to binary form ignoring the sign. Then assemble the numerical part (padded with zeros on the left to give exactly seven digits) with the single bit at the left which indicates the sign. So, using the methods already illustrated several times, we can determine that 8710 = which is exactly 7 digits. So, since is positive, the result we need is 8-bit signed magnitude form For the second number, we have 6310 = , which is just six digits long. We need a seven digit numerical part, so we must append a zero to the left of these six digits. Finally, since is negative, the sign bit at the extreme left of the 8-bit representation is set to 1: David W. Sabo (2014) Number Systems Page 21 of 50

Lecture 2. Binary and Hexadecimal Numbers

Lecture 2. Binary and Hexadecimal Numbers Lecture 2 Binary and Hexadecimal Numbers Purpose: Review binary and hexadecimal number representations Convert directly from one base to another base Review addition and subtraction in binary representations

More information

NUMBER SYSTEMS. William Stallings

NUMBER SYSTEMS. William Stallings NUMBER SYSTEMS William Stallings The Decimal System... The Binary System...3 Converting between Binary and Decimal...3 Integers...4 Fractions...5 Hexadecimal Notation...6 This document available at WilliamStallings.com/StudentSupport.html

More information

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012 Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

More information

Base Conversion written by Cathy Saxton

Base Conversion written by Cathy Saxton Base Conversion written by Cathy Saxton 1. Base 10 In base 10, the digits, from right to left, specify the 1 s, 10 s, 100 s, 1000 s, etc. These are powers of 10 (10 x ): 10 0 = 1, 10 1 = 10, 10 2 = 100,

More information

To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:

To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic: Binary Numbers In computer science we deal almost exclusively with binary numbers. it will be very helpful to memorize some binary constants and their decimal and English equivalents. By English equivalents

More information

Computer Science 281 Binary and Hexadecimal Review

Computer Science 281 Binary and Hexadecimal Review Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two

More information

6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10

6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10 Lesson The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base- system. When you

More information

Section 1.4 Place Value Systems of Numeration in Other Bases

Section 1.4 Place Value Systems of Numeration in Other Bases Section.4 Place Value Systems of Numeration in Other Bases Other Bases The Hindu-Arabic system that is used in most of the world today is a positional value system with a base of ten. The simplest reason

More information

Pre-Algebra Lecture 6

Pre-Algebra Lecture 6 Pre-Algebra Lecture 6 Today we will discuss Decimals and Percentages. Outline: 1. Decimals 2. Ordering Decimals 3. Rounding Decimals 4. Adding and subtracting Decimals 5. Multiplying and Dividing Decimals

More information

Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 INTRODUCTION TO DIGITAL LOGIC

Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 INTRODUCTION TO DIGITAL LOGIC Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 1 Number Systems Representation Positive radix, positional number systems A number with radix r is represented by a string of digits: A n

More information

The string of digits 101101 in the binary number system represents the quantity

The string of digits 101101 in the binary number system represents the quantity Data Representation Section 3.1 Data Types Registers contain either data or control information Control information is a bit or group of bits used to specify the sequence of command signals needed for

More information

Useful Number Systems

Useful Number Systems Useful Number Systems Decimal Base = 10 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Binary Base = 2 Digit Set = {0, 1} Octal Base = 8 = 2 3 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Base = 16 = 2

More information

Number Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi)

Number Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi) Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi) INTRODUCTION System- A number system defines a set of values to represent quantity. We talk about the number of people

More information

Solution for Homework 2

Solution for Homework 2 Solution for Homework 2 Problem 1 a. What is the minimum number of bits that are required to uniquely represent the characters of English alphabet? (Consider upper case characters alone) The number of

More information

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8 ECE Department Summer LECTURE #5: Number Systems EEL : Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz Decimal Number System: -Our standard number system is base, also

More information

Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions.

Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions. Unit 1 Number Sense In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions. BLM Three Types of Percent Problems (p L-34) is a summary BLM for the material

More information

Binary, Hexadecimal, Octal, and BCD Numbers

Binary, Hexadecimal, Octal, and BCD Numbers 23CH_PHCalter_TMSETE_949118 23/2/2007 1:37 PM Page 1 Binary, Hexadecimal, Octal, and BCD Numbers OBJECTIVES When you have completed this chapter, you should be able to: Convert between binary and decimal

More information

Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal. Binary Representation The basis of all digital data is binary representation. Binary - means two 1, 0 True, False Hot, Cold On, Off We must be able to handle more than just values for real world problems

More information

2011, The McGraw-Hill Companies, Inc. Chapter 3

2011, The McGraw-Hill Companies, Inc. Chapter 3 Chapter 3 3.1 Decimal System The radix or base of a number system determines the total number of different symbols or digits used by that system. The decimal system has a base of 10 with the digits 0 through

More information

EE 261 Introduction to Logic Circuits. Module #2 Number Systems

EE 261 Introduction to Logic Circuits. Module #2 Number Systems EE 261 Introduction to Logic Circuits Module #2 Number Systems Topics A. Number System Formation B. Base Conversions C. Binary Arithmetic D. Signed Numbers E. Signed Arithmetic F. Binary Codes Textbook

More information

47 Numerator Denominator

47 Numerator Denominator JH WEEKLIES ISSUE #22 2012-2013 Mathematics Fractions Mathematicians often have to deal with numbers that are not whole numbers (1, 2, 3 etc.). The preferred way to represent these partial numbers (rational

More information

Session 7 Fractions and Decimals

Session 7 Fractions and Decimals Key Terms in This Session Session 7 Fractions and Decimals Previously Introduced prime number rational numbers New in This Session period repeating decimal terminating decimal Introduction In this session,

More information

Lecture 11: Number Systems

Lecture 11: Number Systems Lecture 11: Number Systems Numeric Data Fixed point Integers (12, 345, 20567 etc) Real fractions (23.45, 23., 0.145 etc.) Floating point such as 23. 45 e 12 Basically an exponent representation Any number

More information

Basic numerical skills: FRACTIONS, DECIMALS, PROPORTIONS, RATIOS AND PERCENTAGES

Basic numerical skills: FRACTIONS, DECIMALS, PROPORTIONS, RATIOS AND PERCENTAGES Basic numerical skills: FRACTIONS, DECIMALS, PROPORTIONS, RATIOS AND PERCENTAGES. Introduction (simple) This helpsheet is concerned with the ways that we express quantities that are not whole numbers,

More information

Addition Methods. Methods Jottings Expanded Compact Examples 8 + 7 = 15

Addition Methods. Methods Jottings Expanded Compact Examples 8 + 7 = 15 Addition Methods Methods Jottings Expanded Compact Examples 8 + 7 = 15 48 + 36 = 84 or: Write the numbers in columns. Adding the tens first: 47 + 76 110 13 123 Adding the units first: 47 + 76 13 110 123

More information

Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Systems I: Computer Organization and Architecture Lecture 2: Number Systems and Arithmetic Number Systems - Base The number system that we use is base : 734 = + 7 + 3 + 4 = x + 7x + 3x + 4x = x 3 + 7x

More information

CSI 333 Lecture 1 Number Systems

CSI 333 Lecture 1 Number Systems CSI 333 Lecture 1 Number Systems 1 1 / 23 Basics of Number Systems Ref: Appendix C of Deitel & Deitel. Weighted Positional Notation: 192 = 2 10 0 + 9 10 1 + 1 10 2 General: Digit sequence : d n 1 d n 2...

More information

Numbering Systems. InThisAppendix...

Numbering Systems. InThisAppendix... G InThisAppendix... Introduction Binary Numbering System Hexadecimal Numbering System Octal Numbering System Binary Coded Decimal (BCD) Numbering System Real (Floating Point) Numbering System BCD/Binary/Decimal/Hex/Octal

More information

Welcome to Basic Math Skills!

Welcome to Basic Math Skills! Basic Math Skills Welcome to Basic Math Skills! Most students find the math sections to be the most difficult. Basic Math Skills was designed to give you a refresher on the basics of math. There are lots

More information

Unit 6 Number and Operations in Base Ten: Decimals

Unit 6 Number and Operations in Base Ten: Decimals Unit 6 Number and Operations in Base Ten: Decimals Introduction Students will extend the place value system to decimals. They will apply their understanding of models for decimals and decimal notation,

More information

NUMBER SYSTEMS APPENDIX D. You will learn about the following in this appendix:

NUMBER SYSTEMS APPENDIX D. You will learn about the following in this appendix: APPENDIX D NUMBER SYSTEMS You will learn about the following in this appendix: The four important number systems in computing binary, octal, decimal, and hexadecimal. A number system converter program

More information

Fractions to decimals

Fractions to decimals Worksheet.4 Fractions and Decimals Section Fractions to decimals The most common method of converting fractions to decimals is to use a calculator. A fraction represents a division so is another way of

More information

Number Representation

Number Representation Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data

More information

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 04 Digital Logic II May, I before starting the today s lecture

More information

A Step towards an Easy Interconversion of Various Number Systems

A Step towards an Easy Interconversion of Various Number Systems A towards an Easy Interconversion of Various Number Systems Shahid Latif, Rahat Ullah, Hamid Jan Department of Computer Science and Information Technology Sarhad University of Science and Information Technology

More information

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012 CDA 3200 Digital Systems Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012 Outline Data Representation Binary Codes Why 6-3-1-1 and Excess-3? Data Representation (1/2) Each numbering

More information

Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6

Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6 Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6 Number Systems No course on programming would be complete without a discussion of the Hexadecimal (Hex) number

More information

Chapter 1. Binary, octal and hexadecimal numbers

Chapter 1. Binary, octal and hexadecimal numbers Chapter 1. Binary, octal and hexadecimal numbers This material is covered in the books: Nelson Magor Cooke et al, Basic mathematics for electronics (7th edition), Glencoe, Lake Forest, Ill., 1992. [Hamilton

More information

JobTestPrep's Numeracy Review Decimals & Percentages

JobTestPrep's Numeracy Review Decimals & Percentages JobTestPrep's Numeracy Review Decimals & Percentages 1 Table of contents What is decimal? 3 Converting fractions to decimals 4 Converting decimals to fractions 6 Percentages 6 Adding and subtracting decimals

More information

NUMBER SYSTEMS. 1.1 Introduction

NUMBER SYSTEMS. 1.1 Introduction NUMBER SYSTEMS 1.1 Introduction There are several number systems which we normally use, such as decimal, binary, octal, hexadecimal, etc. Amongst them we are most familiar with the decimal number system.

More information

Decimals and other fractions

Decimals and other fractions Chapter 2 Decimals and other fractions How to deal with the bits and pieces When drugs come from the manufacturer they are in doses to suit most adult patients. However, many of your patients will be very

More information

Unsigned Conversions from Decimal or to Decimal and other Number Systems

Unsigned Conversions from Decimal or to Decimal and other Number Systems Page 1 of 5 Unsigned Conversions from Decimal or to Decimal and other Number Systems In all digital design, analysis, troubleshooting, and repair you will be working with binary numbers (or base 2). It

More information

1. The Fly In The Ointment

1. The Fly In The Ointment Arithmetic Revisited Lesson 5: Decimal Fractions or Place Value Extended Part 5: Dividing Decimal Fractions, Part 2. The Fly In The Ointment The meaning of, say, ƒ 2 doesn't depend on whether we represent

More information

Number Systems and Radix Conversion

Number Systems and Radix Conversion Number Systems and Radix Conversion Sanjay Rajopadhye, Colorado State University 1 Introduction These notes for CS 270 describe polynomial number systems. The material is not in the textbook, but will

More information

Decimal Notations for Fractions Number and Operations Fractions /4.NF

Decimal Notations for Fractions Number and Operations Fractions /4.NF Decimal Notations for Fractions Number and Operations Fractions /4.NF Domain: Cluster: Standard: 4.NF Number and Operations Fractions Understand decimal notation for fractions, and compare decimal fractions.

More information

Chapter 1: Digital Systems and Binary Numbers

Chapter 1: Digital Systems and Binary Numbers Chapter 1: Digital Systems and Binary Numbers Digital age and information age Digital computers general purposes many scientific, industrial and commercial applications Digital systems telephone switching

More information

The Crescent Primary School Calculation Policy

The Crescent Primary School Calculation Policy The Crescent Primary School Calculation Policy Examples of calculation methods for each year group and the progression between each method. January 2015 Our Calculation Policy This calculation policy has

More information

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89 by Joseph Collison Copyright 2000 by Joseph Collison All rights reserved Reproduction or translation of any part of this work beyond that permitted by Sections

More information

6 The Hindu-Arabic System (800 BC)

6 The Hindu-Arabic System (800 BC) 6 The Hindu-Arabic System (800 BC) Today the most universally used system of numeration is the Hindu-Arabic system, also known as the decimal system or base ten system. The system was named for the Indian

More information

DIGITAL-TO-ANALOGUE AND ANALOGUE-TO-DIGITAL CONVERSION

DIGITAL-TO-ANALOGUE AND ANALOGUE-TO-DIGITAL CONVERSION DIGITAL-TO-ANALOGUE AND ANALOGUE-TO-DIGITAL CONVERSION Introduction The outputs from sensors and communications receivers are analogue signals that have continuously varying amplitudes. In many systems

More information

The Hexadecimal Number System and Memory Addressing

The Hexadecimal Number System and Memory Addressing APPENDIX C The Hexadecimal Number System and Memory Addressing U nderstanding the number system and the coding system that computers use to store data and communicate with each other is fundamental to

More information

Chapter 4: Computer Codes

Chapter 4: Computer Codes Slide 1/30 Learning Objectives In this chapter you will learn about: Computer data Computer codes: representation of data in binary Most commonly used computer codes Collating sequence 36 Slide 2/30 Data

More information

2 Number Systems. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

2 Number Systems. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to: 2 Number Systems 2.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Understand the concept of number systems. Distinguish

More information

Working with whole numbers

Working with whole numbers 1 CHAPTER 1 Working with whole numbers In this chapter you will revise earlier work on: addition and subtraction without a calculator multiplication and division without a calculator using positive and

More information

COMPSCI 210. Binary Fractions. Agenda & Reading

COMPSCI 210. Binary Fractions. Agenda & Reading COMPSCI 21 Binary Fractions Agenda & Reading Topics: Fractions Binary Octal Hexadecimal Binary -> Octal, Hex Octal -> Binary, Hex Decimal -> Octal, Hex Hex -> Binary, Octal Animation: BinFrac.htm Example

More information

Encoding Text with a Small Alphabet

Encoding Text with a Small Alphabet Chapter 2 Encoding Text with a Small Alphabet Given the nature of the Internet, we can break the process of understanding how information is transmitted into two components. First, we have to figure out

More information

Kenken For Teachers. Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles June 27, 2010. Abstract

Kenken For Teachers. Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles June 27, 2010. Abstract Kenken For Teachers Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles June 7, 00 Abstract Kenken is a puzzle whose solution requires a combination of logic and simple arithmetic skills.

More information

CHAPTER 4 DIMENSIONAL ANALYSIS

CHAPTER 4 DIMENSIONAL ANALYSIS CHAPTER 4 DIMENSIONAL ANALYSIS 1. DIMENSIONAL ANALYSIS Dimensional analysis, which is also known as the factor label method or unit conversion method, is an extremely important tool in the field of chemistry.

More information

Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products

Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products Chapter 3 Cartesian Products and Relations The material in this chapter is the first real encounter with abstraction. Relations are very general thing they are a special type of subset. After introducing

More information

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals: Numeral Systems Which number is larger? 25 8 We need to distinguish between numbers and the symbols that represent them, called numerals. The number 25 is larger than 8, but the numeral 8 above is larger

More information

A Short Guide to Significant Figures

A Short Guide to Significant Figures A Short Guide to Significant Figures Quick Reference Section Here are the basic rules for significant figures - read the full text of this guide to gain a complete understanding of what these rules really

More information

Binary Number System. 16. Binary Numbers. Base 10 digits: 0 1 2 3 4 5 6 7 8 9. Base 2 digits: 0 1

Binary Number System. 16. Binary Numbers. Base 10 digits: 0 1 2 3 4 5 6 7 8 9. Base 2 digits: 0 1 Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1

More information

Numeration systems. Resources and methods for learning about these subjects (list a few here, in preparation for your research):

Numeration systems. Resources and methods for learning about these subjects (list a few here, in preparation for your research): Numeration systems This worksheet and all related files are licensed under the Creative Commons Attribution License, version 1.0. To view a copy of this license, visit http://creativecommons.org/licenses/by/1.0/,

More information

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın Digital Design Assoc. Prof. Dr. Berna Örs Yalçın Istanbul Technical University Faculty of Electrical and Electronics Engineering Office Number: 2318 E-mail: siddika.ors@itu.edu.tr Grading 1st Midterm -

More information

Preliminary Mathematics

Preliminary Mathematics Preliminary Mathematics The purpose of this document is to provide you with a refresher over some topics that will be essential for what we do in this class. We will begin with fractions, decimals, and

More information

2) Write in detail the issues in the design of code generator.

2) Write in detail the issues in the design of code generator. COMPUTER SCIENCE AND ENGINEERING VI SEM CSE Principles of Compiler Design Unit-IV Question and answers UNIT IV CODE GENERATION 9 Issues in the design of code generator The target machine Runtime Storage

More information

Binary Adders: Half Adders and Full Adders

Binary Adders: Half Adders and Full Adders Binary Adders: Half Adders and Full Adders In this set of slides, we present the two basic types of adders: 1. Half adders, and 2. Full adders. Each type of adder functions to add two binary bits. In order

More information

Decimal form. Fw.d Exponential form Ew.d Ew.dEe Scientific form ESw.d ESw.dEe Engineering form ENw.d ENw.dEe Lw. Horizontal

Decimal form. Fw.d Exponential form Ew.d Ew.dEe Scientific form ESw.d ESw.dEe Engineering form ENw.d ENw.dEe Lw. Horizontal Fortran Formats The tedious part of using Fortran format is to master many format edit descriptors. Each edit descriptor tells the system how to handle certain type of values or activity. Each value requires

More information

plc numbers - 13.1 Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

plc numbers - 13.1 Encoded values; BCD and ASCII Error detection; parity, gray code and checksums plc numbers - 3. Topics: Number bases; binary, octal, decimal, hexadecimal Binary calculations; s compliments, addition, subtraction and Boolean operations Encoded values; BCD and ASCII Error detection;

More information

Integer Operations. Overview. Grade 7 Mathematics, Quarter 1, Unit 1.1. Number of Instructional Days: 15 (1 day = 45 minutes) Essential Questions

Integer Operations. Overview. Grade 7 Mathematics, Quarter 1, Unit 1.1. Number of Instructional Days: 15 (1 day = 45 minutes) Essential Questions Grade 7 Mathematics, Quarter 1, Unit 1.1 Integer Operations Overview Number of Instructional Days: 15 (1 day = 45 minutes) Content to Be Learned Describe situations in which opposites combine to make zero.

More information

CHAPTER 5 Round-off errors

CHAPTER 5 Round-off errors CHAPTER 5 Round-off errors In the two previous chapters we have seen how numbers can be represented in the binary numeral system and how this is the basis for representing numbers in computers. Since any

More information

PAYCHEX, INC. BASIC BUSINESS MATH TRAINING MODULE

PAYCHEX, INC. BASIC BUSINESS MATH TRAINING MODULE PAYCHEX, INC. BASIC BUSINESS MATH TRAINING MODULE 1 Property of Paychex, Inc. Basic Business Math Table of Contents Overview...3 Objectives...3 Calculator...4 Basic Calculations...6 Order of Operation...9

More information

Sunny Hills Math Club Decimal Numbers Lesson 4

Sunny Hills Math Club Decimal Numbers Lesson 4 Are you tired of finding common denominators to add fractions? Are you tired of converting mixed fractions into improper fractions, just to multiply and convert them back? Are you tired of reducing fractions

More information

Binary Representation

Binary Representation Binary Representation The basis of all digital data is binary representation. Binary - means two 1, 0 True, False Hot, Cold On, Off We must tbe able to handle more than just values for real world problems

More information

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal: Exercises 1 - number representations Questions 1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal: (a) 3012 (b) - 435 2. For each of

More information

PROBLEMS (Cap. 4 - Istruzioni macchina)

PROBLEMS (Cap. 4 - Istruzioni macchina) 98 CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS PROBLEMS (Cap. 4 - Istruzioni macchina) 2.1 Represent the decimal values 5, 2, 14, 10, 26, 19, 51, and 43, as signed, 7-bit numbers in the following binary

More information

Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit Decimal Division Remember 4th grade long division? 43 // quotient 12 521 // divisor dividend -480 41-36 5 // remainder Shift divisor left (multiply by 10) until MSB lines up with dividend s Repeat until

More information

YOU MUST BE ABLE TO DO THE FOLLOWING PROBLEMS WITHOUT A CALCULATOR!

YOU MUST BE ABLE TO DO THE FOLLOWING PROBLEMS WITHOUT A CALCULATOR! DETAILED SOLUTIONS AND CONCEPTS - DECIMALS AND WHOLE NUMBERS Prepared by Ingrid Stewart, Ph.D., College of Southern Nevada Please Send Questions and Comments to ingrid.stewart@csn.edu. Thank you! YOU MUST

More information

Binary Numbers. Binary Octal Hexadecimal

Binary Numbers. Binary Octal Hexadecimal Binary Numbers Binary Octal Hexadecimal Binary Numbers COUNTING SYSTEMS UNLIMITED... Since you have been using the 10 different digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 all your life, you may wonder how

More information

Counting in base 10, 2 and 16

Counting in base 10, 2 and 16 Counting in base 10, 2 and 16 1. Binary Numbers A super-important fact: (Nearly all) Computers store all information in the form of binary numbers. Numbers, characters, images, music files --- all of these

More information

CS201: Architecture and Assembly Language

CS201: Architecture and Assembly Language CS201: Architecture and Assembly Language Lecture Three Brendan Burns CS201: Lecture Three p.1/27 Arithmetic for computers Previously we saw how we could represent unsigned numbers in binary and how binary

More information

Playing with Numbers

Playing with Numbers PLAYING WITH NUMBERS 249 Playing with Numbers CHAPTER 16 16.1 Introduction You have studied various types of numbers such as natural numbers, whole numbers, integers and rational numbers. You have also

More information

LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology LSN 2 Number Systems Department of Engineering Technology LSN 2 Decimal Number System Decimal number system has 10 digits (0-9) Base 10 weighting system... 10 5 10 4 10 3 10 2 10 1 10 0. 10-1 10-2 10-3

More information

The gas can has a capacity of 4.17 gallons and weighs 3.4 pounds.

The gas can has a capacity of 4.17 gallons and weighs 3.4 pounds. hundred million$ ten------ million$ million$ 00,000,000 0,000,000,000,000 00,000 0,000,000 00 0 0 0 0 0 0 0 0 0 Session 26 Decimal Fractions Explain the meaning of the values stated in the following sentence.

More information

Guidance paper - The use of calculators in the teaching and learning of mathematics

Guidance paper - The use of calculators in the teaching and learning of mathematics Guidance paper - The use of calculators in the teaching and learning of mathematics Background and context In mathematics, the calculator can be an effective teaching and learning resource in the primary

More information

5544 = 2 2772 = 2 2 1386 = 2 2 2 693. Now we have to find a divisor of 693. We can try 3, and 693 = 3 231,and we keep dividing by 3 to get: 1

5544 = 2 2772 = 2 2 1386 = 2 2 2 693. Now we have to find a divisor of 693. We can try 3, and 693 = 3 231,and we keep dividing by 3 to get: 1 MATH 13150: Freshman Seminar Unit 8 1. Prime numbers 1.1. Primes. A number bigger than 1 is called prime if its only divisors are 1 and itself. For example, 3 is prime because the only numbers dividing

More information

This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers

This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers This Unit: Floating Point Arithmetic CIS 371 Computer Organization and Design Unit 7: Floating Point App App App System software Mem CPU I/O Formats Precision and range IEEE 754 standard Operations Addition

More information

PREPARATION FOR MATH TESTING at CityLab Academy

PREPARATION FOR MATH TESTING at CityLab Academy PREPARATION FOR MATH TESTING at CityLab Academy compiled by Gloria Vachino, M.S. Refresh your math skills with a MATH REVIEW and find out if you are ready for the math entrance test by taking a PRE-TEST

More information

Lies My Calculator and Computer Told Me

Lies My Calculator and Computer Told Me Lies My Calculator and Computer Told Me 2 LIES MY CALCULATOR AND COMPUTER TOLD ME Lies My Calculator and Computer Told Me See Section.4 for a discussion of graphing calculators and computers with graphing

More information

Chapter 5. Binary, octal and hexadecimal numbers

Chapter 5. Binary, octal and hexadecimal numbers Chapter 5. Binary, octal and hexadecimal numbers A place to look for some of this material is the Wikipedia page http://en.wikipedia.org/wiki/binary_numeral_system#counting_in_binary Another place that

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

8 Primes and Modular Arithmetic

8 Primes and Modular Arithmetic 8 Primes and Modular Arithmetic 8.1 Primes and Factors Over two millennia ago already, people all over the world were considering the properties of numbers. One of the simplest concepts is prime numbers.

More information

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic Today Binary addition Representing negative numbers 2 Binary Addition Consider the following binary numbers: 0 0 1 0 0 1 1 0 0 0 1 0 1 0 1 1 How do we add these numbers? 3 Binary Addition 0 0 1 0 0 1 1

More information

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer Computers CMPT 125: Lecture 1: Understanding the Computer Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University January 3, 2009 A computer performs 2 basic functions: 1.

More information

Part 1 Expressions, Equations, and Inequalities: Simplifying and Solving

Part 1 Expressions, Equations, and Inequalities: Simplifying and Solving Section 7 Algebraic Manipulations and Solving Part 1 Expressions, Equations, and Inequalities: Simplifying and Solving Before launching into the mathematics, let s take a moment to talk about the words

More information

Paramedic Program Pre-Admission Mathematics Test Study Guide

Paramedic Program Pre-Admission Mathematics Test Study Guide Paramedic Program Pre-Admission Mathematics Test Study Guide 05/13 1 Table of Contents Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 Page 9 Page 10 Page 11 Page 12 Page 13 Page 14 Page 15 Page

More information

1 Description of The Simpletron

1 Description of The Simpletron Simulating The Simpletron Computer 50 points 1 Description of The Simpletron In this assignment you will write a program to simulate a fictional computer that we will call the Simpletron. As its name implies

More information

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

WRITING PROOFS. Christopher Heil Georgia Institute of Technology WRITING PROOFS Christopher Heil Georgia Institute of Technology A theorem is just a statement of fact A proof of the theorem is a logical explanation of why the theorem is true Many theorems have this

More information

Pigeonhole Principle Solutions

Pigeonhole Principle Solutions Pigeonhole Principle Solutions 1. Show that if we take n + 1 numbers from the set {1, 2,..., 2n}, then some pair of numbers will have no factors in common. Solution: Note that consecutive numbers (such

More information

Linear Programming Notes V Problem Transformations

Linear Programming Notes V Problem Transformations Linear Programming Notes V Problem Transformations 1 Introduction Any linear programming problem can be rewritten in either of two standard forms. In the first form, the objective is to maximize, the material

More information