The Representation of Numbers on the Computer (Brief Version- 01/23/2004)

Size: px
Start display at page:

Download "The Representation of Numbers on the Computer (Brief Version- 01/23/2004)"

Transcription

1 0. Introduction The Representation of Numbers on the Computer (Brief Version- 01/23/2004) Brian J. Shelburne Dept of Mathematics and Computer Science Wittenberg University The development of the computer was driven by the need to mechanize arithmetic; that is, to construct a machine that would perform arithmetic quickly and accurately and thereby speed the solution of calculation intensive problems. But if arithmetic was to be performed by "mechanical (or electronic) devices" like computers, efficient ways had to be found to represent numbers on these machines. What follows is a short introduction to the standard methods used to represent numbers on a computer. 1. Unsigned Binary Integers In our everyday decimal notation, we use the ten digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9 to represent the first ten whole number quantities starting at zero. (Note : There is no digit for the quantity we call ten.) To represent whole numbers greater than nine, we use a "string" of digits where the position of a digit in the string determines the weight given to that digit. The weights used are powers of ten. Thus the number 12 represents one ten and two ones. The number 257 represents 2 hundreds (ten to the second power) plus 5 tens (ten to the first power) plus 7 ones (ten to the zero power) or 257 = 2x x x10 0 This is called "positional notation" and any whole number quantity can be represented this way. Now computers are built out of electronic components which are in one of two discrete states, OFF or ON. We assign the symbol 0 to the OFF state and the symbol 1 to the ON state. Using only two binary digits or bits (bit is a contraction of binary digit), integers can be represented using base 2 or binary notation. Like decimal notation, the position of a binary digit in binary notation determines the weight given it. However, the weights are powers of two, not ten. For example the binary number 1101 represents 1 "eight" (two to the third power) plus 1 "four" (two to the second power) plus 0 "twos" (two to the first power) plus 1 "one" (two to the zero power) or 1101 = 1x x x x2 0 = = 13 This rewriting of a binary number as a "sum of powers of two" is also a simple technique to convert it to its corresponding decimal representation. Note : It is useful to know the powers of two from 2 0 up to 2 10 (or even 2 16 ). The following "table" is easily generated by starting at 2 0 = 1 and doubling each value until 2 16 is obtained. 2 0 = = = = = = = = = = = = = = = = = Converting Binary to Decimal Representation As mentioned above, one method to convert binary representation to decimal representation is to write the binary representation as a "sum of powers of two". This requires knowing the powers of two : 1, 2, 4, 8, 16, 32, 64 etc. 1

2 Example: Convert binary to decimal by expanding it as a sum of powers of two = 1x x x x x x2 0 = = 53 Exercise: Convert the following binary representations to their decimal equivalents by expanding each as a sum of powers of two. a b A more "elegant" technique for converting binary to decimal is called Horner's Method or Synthetic Division. This technique does not require computing the decimal values for each power of two (thus minimizing the amount of multiplication). The set-up for Horner's method (see below) uses three lines: the binary representation is placed on the first line, a single 0 is placed in the first (left-most) column of the second line and the third line is left empty except for a "2 " (the 2 is the multiplier) off to the left. A bar separates the second and third lines. Horner's Method Set-Up <- line line line 3 Horner's method works from left to right. Starting with the left-most column, sum the two digits on lines 1 and 2 (1 + 0) and place the sum below the bar in line 3. Then multiply this sum by 2 transferring the product to the next column of line 2 (see below). Repeat this "sum, multiply by 2, transfer to next column" process for each digit in line 1. The final sum in the right-most column of line 3 is the corresponding decimal representation. Initial Set-Up After 1 Iteration Final Result ^ decimal result Exercise: Use Horner's Method to convert the binary representations in the above exercise to decimal. 3. Converting Decimal to Binary Representation An easily remembered method for converting decimal representation to binary is to repeatedly subtract out powers of two from the decimal representation. Begin by determining the largest power of two less than or equal to the decimal value. (For example 2 4 = 16 is the largest power of two less than or equal to 31 while 2 5 = 32 is the largest power of two less than or equal to 32.) Subtract the largest power of two from the decimal value and repeat by finding the largest power of two less than or equal to the remainder. Subtract again. Repeat until you reach zero. The powers of two subtracted out make up the binary representation. Example : Convert 13 (decimal) to binary 13-8 = 5 where 8 = = 1 where 4 = = 0 where 1 = 2 0 Therefore 13 = 1x x x x2 0 =

3 A useful trick to use with the "Subtraction of Powers of Two" method is to first list the powers of two from right to left leaving a blank line below each power Scanning from left to right, compare each power of two with the number to be converted. If the power of two is strictly larger, put a 0 in the blank below it; if it's less than or equal to the number, put a 1 in the blank below it, subtract the power of two from the number, and continue with the remainder.. Subtracting out powers of two to convert decimal to binary is the inverse of expanding by powers of two to convert binary to decimal. Example : Convert 104 (decimal) to binary Therefore 104 decimal equals binary This method often gives leading zeros which, as shall be seen below, is necessary when representing binary integers on the computer. A more elegant method, called the Integer Division Algorithm, involves repeated integer division of the decimal value by 2 while keeping track of the remainders. The remainders produce the binary representation in reverse order (i.e. the first remainder is the right-most or least significant bit). In the example worked out below, 13 is first divided by 2 to yield quotient 6 remainder 1. Continue by dividing the quotient 6 by 2 to obtain a new quotient 3 and a remainder 0. When the quotient eventually reaches 0, stop. The reminders (in reverse order) give you the binary representation. As noted below, "toppling" over the remainders will yield the correct binary representation. Example : Convert 13 (decimal) to binary r 1 Note L : If you "topple over" --- the "remainder tower" 2 3 r 0 you will have the --- binary representation. 2 1 r r 1 => Note the use of the "upside-down" division sign. 3

4 4. Representing Unsigned Integers on the Computer. Computers use a fixed number of bits to store a binary integer. The number of bits used is a function of the way the memory of the computer is configured. Generally the individual bits of memory are not individually accessible (i.e. "addressable"). Instead a fixed number of bits is grouped into "cells" (e.g. 8-bit bytes or 16-bit words) and only these larger "cells" can be accessed. The Intel 80x86 family can use either an 8-bit byte or a 16-bit word to store a binary integer. So decimal 13 is either or The Intel 80x86 is "byte" addressable. With the advent of the Intel 386, 486, and Pentium architectures four byte 32-bit "double word" length integers were added. So 13 decimal is Exercises 1. What are the largest unsigned binary integer representable by the following memory cell sizes and what are their corresponding decimal values? a. a 4 bit "nybble" (Yes, a 4 bit "half" byte is sometimes referred to as a "nybble") b. an 8 bit byte c. a 16 bit "word" (as in the Intel 80x86) 2. Suppose you added 1 to the largest integer represented by 16 bits. That is = The latter value is a 1 followed by 16 zeros. What is the value of this binary representation? (Careful - it's NOT 2 17.) If the largest binary integer representable by 16 bits is one less than the above answer, use this method to find the decimal value of the largest integer representable by a 32 bit double word. 5. Hexadecimal Notation A drawback to binary representation is length; many bits are needed to represent even relatively small integers. Shorter integers are possible using octal (base 8) and hexadecimal (base 16) representations which are easily obtained by "grouping" the bits of a binary representation.. To convert from binary to hexadecimal, start from the right, group the bits by fours and convert each grouping to its corresponding hexadecimal digit. Since hexadecimal (base 16) notation requires sixteen digits and since we lack symbols for the values ten (binary 1010), eleven (binary 1011), twelve (binary 1100), thirteen (binary 1101), fourteen (binary 1110), and fifteen (binary 1111) we use the symbols (digits) A, B, C, D, E, and F for these values. The correspondences are listed in the table below. Four Bit to Hexadecimal Digit Conversion Table 0000 = = = = C 0001 = = = = D 0010 = = = A 1110 = E 0011 = = = B 1111 = F Remember that A through F are the hexadecimal digits for the decimal values ten (binary 1010) through fifteen (binary 1111). 4

5 Binary to hexadecimal conversions are easy : group by fours and convert each grouping using the table (which is easily memorized). Example : Convert binary to hexadecimal = = D4 This technique "works" because we are factoring out powers of 16 (2 4 ) from the binary representation. Recall that, as a sum of powers of two can be written as 1x x x x x x x x2 0 Starting from the right, group the terms by four and factor out the common power of 16 from each grouping. (1x x x x2 0 )x (0x x x x2 0 ) x 16 0 Finally, rewrite the expression in front of each power of 16 as an octal digit. D x x 16 0 = D4 (hexadecimal) To convert from hexadecimal to binary, replace each hexadecimal digit with its 4-bit equivalent. Example : Convert B9E2 hexadecimal to binary B9E2 = = Notation : To signify whether a representation is binary, octal, decimal or hexadecimal, we shall adopt the convention of attaching the post-fixed letter, 'b' for binary, 'o' for octal, 'd' for decimal, 'h' for hexadecimal, to the integer. For example, 157o is 157 octal; 157h is 157 hexadecimal. We shall use this "postfix" notation whenever the radix (i.e base) of the integer is not clear from context. (Another convention for hexadecimal is to use the prefix '0x' as in 0x157) Exercise 1. Convert the following binary representations into hexadecimal a b Convert the following representations into binary a. ACE0h b. 8B3h 6. Hexadecimal to Decimal Conversions Conversions from hexadecimal to decimal can be done indirectly by first converting hexadecimal to binary then converting binary to decimal. Conversions from decimal to hexadecimal can be done indirectly by reversing the above process. It is also possible to alter the conversion methods from Sections 2 and 3 in an obvious manner to directly convert between hexadecimal and decimal. Exercise: Think about how you would alter the conversion methods from Section 2 (expansion by powers of two, Horner's method) and the conversion methods from Section 3 (subtracting powers of two, integer division) to obtain methods that directly convert between hexadecimal and decimal. Apply your methods to do the following. a. Convert 7Eh to decimal using either expansion by powers of 16 or Horner's method. Check your work by using either subtracting powers of 16 or integer division to convert your answer back to octal. 5

6 b. Convert BADh to decimal using either expansion by powers of 16 or Horner's method. Check your work by using either subtracting powers of 16 or integer division to convert your answer back to hexadecimal. Hint! When working with hexadecimal integers using decimal arithmetic, it is sometimes useful to replace each hexadecimal digit with its decimal equivalent. For example, rewrite BADh as (11)(10)(13)h 7. Binary Addition and Subtraction Binary Addition of two digits is trivial; there are only four "rules" Note that the last sum has a "carry out"; that is 1 plus 1 is 0 "carry" 1. More interesting and useful is binary addition with a "carry in" which is the "carry out" from the previous column <- carry in Using the above eight "rules", any two binary integers can be added. Example: Binary Subtraction is more complicated because of the need to "borrow" from the next column. This is indicated by placing a -1 above the column to the left to indicate that 1 must be borrowed from the next column over borrow -> The only time a borrow is needed is when subtracting 1 from 0 (in the second subtraction above). Essentially, you borrow 10b from the next column over so you subtract 1 from 10b leaving a difference of 1. The effect of a borrow from a previous column on the right can get a bit complicated. If the current minuend (upper digit) is a 1, it will be used by the borrow from the previous column and so it effectively becomes a zero (see subtractions 3 and 4 below). If the minuend is a 0 a borrow "in" from the right must be propagated to the next column on the left which has the ultimate effect of making the 0 minuend into a 1. (When you borrow 10b from the column on the left, since 10b = 1 + 1, one of the 1's is used by the borrow "in" from the right while the remaining 1 becomes the new minuend). See subtractions 1 and 2 below. 6

7 It helps to distinguish between a "borrow in" (a borrow made by the column on the right) or a lend and a "borrow out" (a borrow from the next column on the left). borrow borrow borrow borrow out in out in in out in If you think about it, subtraction with binary integers is just like subtraction with decimal integers. However, as we will see below, there is easier way to do binary subtraction. Example : Exercises: Evaluate the following a b c d e Signed Binary Integers : Two's Complement Representation So far we have only discussed representations for unsigned binary integers. One way to represent signed binary integers uses the left-most bit to store the sign of the integer (0 for +, 1 for -) and uses the remaining bits to store the magnitude of the integer. This is called sign-magnitude representation. If a signed integer were stored in an 8-bit byte, the left most bit (bit 7) would store the sign and the other seven bits (bits 0-6) would store the magnitude. sign magnitude _ _ For example, the 8-bit sign-magnitude representation of +67 would be while -67 would be Sign-magnitude representation for binary integers has been superseded by other representations, in particular two's complement representation. However, sign-magnitude is still used in floating point representation. To introduce two's complement representation for signed binary integers we begin by looking at odometers, those mileage gauges found on cars.. Assume we have a 3 bit binary odometer. If it was initialized to 000 and we drove forward one mile, it would read 001. If we drove forward two miles it would read 010. If we drove forward three miles it would read 011. On the other hand, if we started at 000 and drove backwards one mile it would read 111. Thus we can set up the following correspondence between the signed integers from -4 to +3 and the eight 3-bit binary odometer readings. 3-Bit Binary Odometer Readings and Signed Integers odometer signed value Note that all negative values are assigned to "odometer representations" which begin with 1. 7

8 This technique can be scaled up. Assume we have an 8 bit binary odometer. If it was initialized to and we drove -1 mile (i.e. 1 mile backwards), it would read Minus 2 miles would be etc. So there is an obvious one to one correspondence between the range of signed integers and the binary integers starting at and increasing to followed by and increasing to (Actually "follows" since if you add 1 to and throw away the "carry out", you would get ) 8-Bit Two's Complement Integers and their Signed Decimal Values This method for representing signed binary integers is called Two's Complement Representation. The 8-bit binary representations between and are the integers between 0 and +127 (you should check that is 127); the 8-bit binary representations between and are the integers from -128 to -1. Representations for negative integers have a 1 as their left-most bit; positive integers have 0. One advantage of two's complement representation is the ease of detecting positive or negative integers (the left most bit is referred to as the "sign bit"). Aside from the "binary odometer" model, there is another way to understand two complement representation. This involves assigning a negative weight (value) to the left most sign bit. For example, above we said that represents -2. If we express this as a sum of powers of two with the left-most bit having the negative weight -(2 7 ) instead of 2 7, we have 1 -(2 7 ) = = -2 Expressing a two's complement representation as a sum of powers of two with the weight of the sign bit negated makes it easy to convert any two's complement representation to its corresponding signed integer value. It obviously "works" for negative integers; it also works for positive integers since the left most bit being 0 contributes nothing to the sum; only the remaining positive weights contribute. Another advantage to two's complement representation is the ease that one can convert any positive binary representation to its negative counterpart. The trick is "complement and add one". This allows us to use the binary to decimal conversion methods of Section 2 to convert any two's complement representation to a signed decimal integer and the decimal to binary methods of Section 3 to convert any signed decimal integer to two's complement representation. Two's Complement Representation is fixed length. It is important to point out that two's complement representation is a fixed length representation where all integers have the same number of bits. That is, you can have 3-bit two's complement representation or 8-bit two's complement representation or 16-bit two's complement representation etc. It is fixed length because the negative weight given to the sign bit is determined by the position of the sign bit. As a result all positive two's complement representations have leading zeros and all negative two's complementation representations have leading ones. So +1 in 8-bit two's complement representation is and never just 1. Expanding by powers of two or Horner's method will convert any positive two's complement representation (sign bit is 0) to decimal. No extra work is needed. However, if the two's complement representation is negative (sign bit is 1), use "complement and add one" to get the corresponding positive two's complement representation then apply expanding by powers of two or Horner's method. Negate the decimal result. 8

9 Example : Convert two's complement to signed decimal complement and add 1 to <- complement 1 <- add Now convert binary to decimal (sums of powers of two) 1110 = 1 x x x x 2 0 = = 14 negate 14 to obtain -14 Therefore b = -14 Subtracting out powers of two or integer division will convert any positive signed decimal to an n-bit two's complement representation. No extra work is needed except remembering to include the leading zeros! To convert a negative decimal integer, apply subtracting out powers of two or integer division to the corresponding positive decimal value, expand the binary integer to n-bits then use complement and add one to obtain the n-bit two's complement representation. Example : Convert -57 to 8-bit two's complement representation negate -57 to get 57 convert 57 to an 8-bit binary integer (subtract out powers of two) <- powers of Finally complement and add <- complement 1 <- add = -57 You can always expand by powers of two to check your work. Example: Using the expand by powers of two with the left-most bit negated verify that equals = -57 Finally, the "complement and add one" method also converts any negative two's complement representation to its positive counterpart < <- complemented + 1 <- add <

10 Exercise: Express the following integers using 8-bit two's complement representation a. 119 b. -76 c. -63 d. -23 e Representing Signed Binary Integers on the Computer As noted above two's complement representation is a fixed length notation. When representing signed integers using two's complement representation on a computer, the number of bits used will be a function of that computer's memory "cell" size (recall Section 4). For example, using an 8 bit (byte) representation for integers, the positive integers run from to and the negative integers run from to Exercise: What is the range (in decimal) of signed integers using an 8-bit byte? Give both the positive range and the negative range. The Intel 80x86 family is a 8-bit byte addressable architecture so it uses either an 8-bit byte or a 16 bit word (or a 32 bit double word for 386 and above) two's complement representation. It also uses hexadecimal notation. With an 8-bit byte, the Intel 80x86 has a range of 00h to 7Fh (+127) for positive integers and a range of FFh (-1) to 80h (-128) for negative integers. In hexadecimal, negative two's complement integers begin with the digits 8 through F. Exercise: In hexadecimal, what is the range of signed integers using 16-bit two's complement representation? Remember that since two's complement representation is fixed length, the binary representations have the SAME NUMBER OF BITS. Finally, if a 32-bit double word two's complement representation is used, positive integers range from h to 7FFFFFFFh; negative from FFFFFFFFh to h. 10. Addition and Subtraction with Two's Complement Representation Binary addition with two's complement representation is the same as binary addition with unsigned binary integers provided that any "carry out" from the left-most sign bit is thrown away. This works for both positive and negative two's complement representations. Example : Add -23 to 17. We first find the 8-bit twos complement representations of -23 and < < <- complement + 1 <- add < Then add both representations < < <- -6? 10

11 Since the sign bit of the sum is 1, the sum is negative. To determine the magnitude of the sum, "complement and add one" <- complement + 1 <- add <- equals 6 So -6 is the answer which agrees with Subtraction is done by addition of a negative value. That is, to subtract B from A (A - B), complement and add one to B which yields -B and add this to A. (A - B = A + (-B)). Thus no separate rules for subtraction are needed! Exercise: Evaluate the following by converting all integers to 8-bit two's complement representation and add. Remember that subtraction is done by adding the negative value. Convert your answer back to decimal to make sure it's correct. a. 98 b. -43 c. -37 d e. 98 f. -43 g. -37 h Arithmetic Overflow Using 8-bit twos complement representation, suppose we try to add 78 to is and 67 is which is a negative integer (note the leading 1) On reflection we might realize that equals 145 which is outside the range ( ) of integers representable using 8-bit two's complement representations. Examining the calculation we observe that there was a carry from the 64's bit (2nd column on the left) into the sign bit (left-most column) which changed the sign of the result. Suppose we try to add -78 and is and -67 is which is a positive integer (note the leading 0) Again this is not surprising since adding -78 and -67 yields a result outside of the range Examining the calculation we note that the two sign bits when added together yielded a 0 for the sign bit in the result (we threw away the carry out from the sign bit). 11

12 To further examine all possibilities, let us add -78 to +67 and +78 to -67. Both will result in correct answers < < < < < <- +11 In the first case there was no carry into the sign bit (left-most bit) or carry out of the sign bit. In the second case there was both a carry in and a carry out of the sign bit. If we contrast the two correct cases to the two incorrect cases, the first incorrect case had a carry in to the sign bit but NO carry out of the sign bit and the second had a carry out but NO carry in to the sign bit. This is gives us a simple way to detect an "overflow" condition, i.e the generation of a result that is outside the range of representable integers: If "Carry In" (to sign bit) does NOT equal "Carry Out" (from sign bit) then OVERFLOW! 12. Fractional Binary Numbers - Positional Notation Just like decimal numbers, binary numbers can have digits below the "binary" point (called the decimal point with decimal notation). In positional notation, bits below the binary point have weights which are negative powers of two. For decimal notation, digits below the decimal point represent tenths (10-1 ), hundredths (10-2 ), thousandths (10-3 ) etc. In binary notation bits below the binary point represent halves (2-1 ), fourths (2-2 ), eighths (2-3 ) etc. Example : Convert binary to decimal by expanding by powers of two b = 1x x x x x x2-3 = = The "expanding by powers of two" method can be used to convert any binary number with or without a fractional part, into its corresponding decimal equivalent. Exercises: Convert the following binary reals to their decimal equivalents. a b c A binary real has two parts : an integer part consisting of the digits above the binary point and a fractional part consisting of digits below the binary point. We will refer to this fractional part as a fraction, not to be confused with the idea of a rational binary number, one which is in the form a/b where a and b are binary integers (i.e. 1/100 is binary for 1/4) 13. Conversion of Binary Fractions to Decimal While "expanding by powers of two" is a quick and easy technique to convert any binary number to its decimal equivalent, there is an extension of Horner's method which will convert any binary number to its decimal equivalent. The integer part of a binary number can be converted using Horner's method as presented in Section 2. The fractional part can be converted using a variant of this algorithm. The initial set up of the variant of Horner's method, like the original, uses three lines. The fraction digits appear on the first line beginning with a 0 before the decimal point. A single 0 appears in the last column of the second line and the third line is empty except for a " 0.5" off to the right.. 12

13 <- 0 point binary fraction For this variant of Horner's method, work right to left. Sum the numbers in the first and second lines, place the result on the third line, multiply this sum by 0.5 and transfer the product to the second line one moving column to the left. Repeat this add, multiply by 0.5, transfer process.. The final sum on the third line left most column is the decimal value. Example : Convert b to decimal Initial Set Up Final Result (right to left) result Exercises Using Horner's method (above) convert the following binary fractions to their decimal equivalents. a b c Conversion of Decimal Fractions to Binary Converting a decimal fraction to its binary equivalent can be done by subtracting out negative powers of two in the manner similar to converting a decimal integer to binary. First, list out the values of the first few negative powers of 2 left to right, leaving blanks below to be filled in with either 0 or 1. Initial Setup : Scan the values of the negative powers of two left to right and if a value is too large, place a 0 in the blank below it; otherwise subtract that value from the decimal fraction and place a 1 in the corresponding blank. Repeat with the reduced value terminating when you reach zero or enough bits have been generated. 13

14 Example : Convert to binary <- final result <- 0.5 is < is so = 0.101b This technique is awkward because of the difficulty of generating the decimal values needed and subtracting them out. Fortunately there is a better way which uses repeated multiplication If N is the decimal number you are trying to convert, multiply it by two. The product will have an integer part (digits above the decimal point) and a fractional part (digits below the decimal point). The integer part (either a 0 or 1) will be the first bit in the binary fraction. Continue by multiplying the fractional part by two. The integer part (0 or 1) of this multiplication will be the second bit in the binary fraction. Repeat this process on the fractional part until either zero results or a sufficient number of bits in the binary fraction have been generated Example : Convert to binary * 2 -> 0.75 multiply by 2 int(0.75) -> 0 extract the integer part 0.75 <- frac(0.75) extract the fractional part 0.75 * 2 -> 1.5 multiply by 2... int(1.5) -> <- frac(1.5) 0.5 * 2 -> 1.0 int(1.0) -> <- frac(1.0) 0.011b <= result 14

15 Example : Convert 0.3 to binary * 2 -> 0.6 int(0.6) -> <- frac(0.6) 0.6 * 2 -> 1.2 int(1.2) -> <- frac(1.2) 0.2 * 2 -> 0.4 int(0.4) -> <- frac(0.4) 0.4 * 2 -> 0.8 int(0.8) -> <- frac(0.8) 0.8 * 2 -> 1.6 int(1.6) -> <- frac(1.6) 0.6 * 2 -> 1.2 int(1.2) -> <- frac(1.2) 0.2 * 2 -> 0.4 int(0.4) -> <- frac(0.4) At this point, observe that the algorithm repeats, so 0.3 decimal is the repeating binary fraction Exercise: Using the repeated multiplication algorithm, convert the following decimal fractions into binary fractions. If the binary fraction repeats, indicate the repeating pattern of bits a b c. 0.1 d Fixed Point Representation One obvious way to store a binary real on a computer is to store both integer and fractional parts while keeping track of where the binary point is. For example, using a single 8-bit byte, we could store a four bit integer part in the upper four bits and a four bit fractional part in the lower four bits with the assumed binary point being between bits 3 and 4. Example : Store = in an 8-bit fixed point representation integer fraction <- contents of byte <- bit number ^ binary point Another way would be to use adjacent cells (bytes) of memory with the assumed binary point between the two bytes. 15

16 Example : Represent = b in fixed point representation using adjacent 8-bit bytes integer fraction ^ binary point In fixed point representation, a binary real number has an integer part and a fractional part with an assumed binary point separating the two. Example : Store = b using adjacent 8-bit bytes integer fraction binary point In fixed point representation all the standard methods for addition and subtraction work. Even more interesting is that two's complement representation goes over in a natural way with fixed point representation. To obtain the negative representation, complement and add one to the right most position. Example : Find the two's complement fixed point representation of < <- complement + 1 <- add < Check: = Additional Note : Fixed point representation is no longer used having been superseded by floating point notation, discussed below. Exercises: a. Using a one-byte fixed point two's complement representation with the binary point between bits 3 and 4, what is the magnitude of the smallest number? The largest number? b. In representing integers, the difference between consecutive integers is 1. What is the difference between consecutive fixed point representations assuming the one-byte representation above is used? c. Using a two-byte fixed point two's complement representation with the binary point between the bytes, answer the questions from parts a and b above. 16

17 16. Scientific Notation in Binary Recall that scientific notation is used to represent very large or very small numbers. Example : 1,000,000,000,000 (one trillion) = 1.0 x ,000,000,001 (one trillionth) = 1.0 X The same can be done in binary. The binary real can be written as x where we shift the binary point 4 (decimal) or 100 (binary) places to the left. In scientific notation, the decimal or binary point can be placed anywhere with an appropriate adjustment to the exponent (power). There is a standard convention whereby the binary (or decimal) point is shifted (with an appropriate adjustment to the exponent) so that it appears immediately to the left of the leading non-zero digit. So all digits above (to the left of) the binary (or decimal) point are 0 and the first digit below (to the right of) the binary (or decimal) point is nonzero. Such a representation is said to be normalized. Example : normalized is written as x The sequence of bits is called the mantissa or fraction; the power to which 10 is raised, in this case 101, is the exponent. 17. Floating Point Notation - A Byte-Size Example In floating point representation, the sign of the number, the fraction (mantissa), and the exponent from the normalized binary scientific notation form are stored in separate fields within one or more contiguous cells (bytes) of memory. As an example, we will store all three values within one 8-bit byte. Bit 7, the left-most bit will hold the sign (0 for positive, 1 for negative), bits 4 through 6 will hold the exponent, and bits 0 through 3 will hold the fraction. sign exponent fraction We will use the sign magnitude convention to represent signed quantities. Given any positive normalized floating point binary representation (e.g = = x 10 1 ), it should be obvious how the values in the sign bit and the fraction field are obtained. What is not clear (or might not be just yet) is what is entered into the exponent field since we need to account for both positive and negative exponents. For our 8-bit floating point representation, we will use "excess 011" notation for the exponent field where the value for the exponent field is obtained by adding 011 to the exponent. For example, if 001 is the exponent, the exponent field will contain = 100. Thus x is stored as This "excess 011" (or "excess 3") notation maps the signed exponents from -3 to + 4 to the binary range 000 to 111 where -3, -2, and -1 map to 000, 001, and 010 (except the exponent 000 is not used - see below), 0 maps to 011, and +1 through +4 maps to 100, 101, 110, and 111. Note that order is maintained! There is one final feature to our 8-bit floating point representation. We always normalize our numbers first. But since the first digit to the left of the binary point is always 1, to save bits (and get an extra bit of precision), we never store this 1-bit. Thus 2.25 would be stored not as but as (note that the fraction is shifted left). 17

18 Example : Express 0.35 in 8-bit binary floating point notation 0.35 º = (binary). This is stored as (not ) where the value in the exponent field, 001, is obtained by adding 011 to -10. To store the negative value -0.35, do the same but set the sign bit to 1. Example: Express in 8-bit binary floating point notation 2.25 = 10.01b = (binary) This is stored as where the value in the exponent field, 100, is obtained by adding 011 to 1 and the sign bit is set to 1. Thus to convert any binary real to the above 8-bit floating point representation a. rewrite the (positive) binary real in scientific binary notation b. normalize (shift binary point so the leading 1 is to the immediate left and adjust exponent accordingly) c. add 011 to the exponent and insert into the exponent field d. drop the leading 1 of the fraction and insert the following 4 bits into the fraction field e. set the sign bit (0 for positive; 1 for negative). The representation for 0 in floating point is a special case. We use for zero. By convention the exponent field is never 0 except for the representation (or for negative 0!). Thus any represent with a zero exponent field and a non-zero fraction (e.g ) is illegal The largest (magnitude) real that is representable is = x = b = 31 decimal (-31 is represented as ). The smallest (magnitude) normalized non-zero real that is representable is = = 0.01b = However the next larger number is = which differs by So relative precision is above 15/1000 Floating point representation values are not "evenly distributed". Unlike the integers where the difference between any two consecutive integers is always 1 or fixed point notation where the difference between any value and the "next" is fixed (for example, using the two byte fixed point format from Section 19, the difference is 2-8 ), the difference between consecutively representable floating point representation varies depending on the exponent and the number of digits represented in the fraction. Example : The difference between the smallest normalized floating point representation, , and the next smallest, is 2-6 = However, the difference between the largest floating point representation, = 31 and the next to largest, = 30 is 1! The difference depends on the exponent and the number of bits in the fraction. There is the question of why the exponent field comes before the fraction field and why excess 011 notation is used for the exponent. Presumably one reason is that it permits positive floating point representations to have the same ordering when considered as integer quantities. Consider the following example. 18

19 Example : Express +4.0, , and 0.0 as 8-bit floating point representations +4.0 = 100.0b = 1.0 x (binary) = = = 10.0b = 1.0 x (binary) = = = 0.10b = 1.0 x 10-1 (binary) = = = 0.01b = 1.0 x (binary) = = = = 0 If you treat the above positive floating point representations for +4.0, +2.0, +0.5, and 0.0 as unsigned integers, they are ordered by their values as the 8-bit unsigned integers 80, 64, 32, 16 and 0. Positioning the exponent field first and adding 011 to it gives positive exponents greater weigh when the representation is considered as an unsigned integer. This means that any comparison "circuit" that compares unsigned integers for less than, less than or equal to, greater than, greater than or equal to, etc will also work for positive floating point representations. 18. Floating Point Notation - A Four Byte Example In floating point notation, the sign of the number, the fraction and the exponent of the normalized binary scientific notation form are stored in separate fields within one or more continuous cells of memory. In 8-bit byte addressable architectures usually four contiguous bytes are used to hold all three fields. If we number the 32 bits of four consecutive 8-bit bytes right to left 0 to 31, the right most bit (bit 31) would be the sign bit, the next 8 bits (bits bits 23-30) would store the exponent, and the remaining 23 bits would hold the normalized fraction (where the binary point is shifted to be to the immediate right of the leading 1 bit and the exponent adjusted accordingly). To get an extra bit of precision the leading 1 to the left of binary point in the normalized fraction is implied. sign exponent field fraction field _ _ The sign bit is used for the sign of the mantissa where 0 indicates plus and 1 indicates minus (sign - magnitude convention). The value actually stored in the exponent field is not the exponent itself but the exponent offset by (offset by 7Fh or excess 7Fh ). That is, if the exponent is 101, the value = would be stored in the exponent field. An exponent of -101 would be ( ). The effect is to "encode" all positive and negative exponents as unsigned binary integers. Positive exponents have a 1 in the left-most bit position; zero and negative exponents have a 0. As observed in the previous section, you can treat two positive floating point representations as unsigned integer quantities and correctly compare them. Alternately you can separately treat the 8 bits of the exponent and the 23 bits of the mantissa as two unsigned integers. Comparing the two exponents determines which exponent and which floating point representation is larger; if the exponents are the same, go on to compare mantissas. The fraction is always left justified in the mantissa field. Since the fraction is first normalized so that the leading 1 would normally appear to the left of the binary point, this bit is not stored giving the 23-bit fraction field 24 bits of precision. The exponent field is never zero exception to represent a floating point 0 where all 32 bits are 0. Example : in floating point representation would appear as

20 Example : in floating point representation would appear as Converting a decimal number to floating point representation takes a bit of doing. Basically this requires: 1. Converting a decimal number to binary fixed point notation which usually requires handling the integer and fraction parts separately 2. Converting binary fixed point to normalized binary scientific notation 3. Offsetting the exponent value by and insert into the exponent field 4. Drop the leading 1 bit of the fraction and insert the remaining 23 bits into the fraction field 5. Set/clear the sign bit. Example : Convert to floating point representation decimal = (binary) 2. = x offset plus exponent : = => (drop first 1) Note that has a repeating binary representation, so we truncated after 24 bits. Exercise: Convert the following decimal real numbers to floating point representation. a b c Convert the following floating point representations to decimal real numbers. d e Advantages and Disadvantage of Floating Point Representation The obvious disadvantage of floating point representation is the difficulty in converting between decimal numbers and floating point representation. In addition, any "hardware" used to perform arithmetic operations on floating point representations will be very complex (hence expensive) since exponent and fraction have to be treated separately. In fact, many early computers did not support hardware floating point operations; operations had to be done in software which is slower. However, the advantages more than make up for the disadvantages. The range of expressible numbers is greatly increased using floating point representation. 20

21 Example : The smallest value (magnitude) greater than 0 is which is 1.0 x = 1.0 x º x Example : The largest value (magnitude) is which is x º 2 x º 3.40 x Note: An exponent field with all 1's is reserved to denote plus or minis infinity. A second issue deals with precision, that is the number of digits in a decimal real number that can be represented. We've observed that many decimal numbers have repeated binary expansions which are truncated after the 24th bit. How much error does this introduce? With out going into the details, the relative error introduced by floating point representation is on the order of 2-24 = x This means that floating point representations are accurate to about 7-8 decimal digits. In summary, floating point representation permits a much larger range of real numbers to be represented than is possible with fixed point representation. The 32-bit floating point representation given above corresponds to the IEEE (754) Standard for Binary Floating Point Arithmetic. While the general ideas are the same, floating point representations for different computer architectures can differ in the details like how many bits are used to store the normalized mantissa, how many bits are used to store the exponent etc. For example, the Intel 80x86 family has 32-bit 64-bit and 80-bit floating point representations. BriefNum.doc 01/23/04 21

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

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

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

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

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

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

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

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

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

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

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal 2/9/9 Binary number system Computer (electronic) systems prefer binary numbers Binary number: represent a number in base-2 Binary numbers 2 3 + 7 + 5 Some terminology Bit: a binary digit ( or ) Hexadecimal

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

Positional Numbering System

Positional Numbering System APPENDIX B Positional Numbering System A positional numbering system uses a set of symbols. The value that each symbol represents, however, depends on its face value and its place value, the value associated

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

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 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

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

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

Math Workshop October 2010 Fractions and Repeating Decimals

Math Workshop October 2010 Fractions and Repeating Decimals Math Workshop October 2010 Fractions and Repeating Decimals This evening we will investigate the patterns that arise when converting fractions to decimals. As an example of what we will be looking at,

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

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

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

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

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

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

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

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

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

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

CS321. Introduction to Numerical Methods

CS321. Introduction to Numerical Methods CS3 Introduction to Numerical Methods Lecture Number Representations and Errors Professor Jun Zhang Department of Computer Science University of Kentucky Lexington, KY 40506-0633 August 7, 05 Number in

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

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

26 Integers: Multiplication, Division, and Order

26 Integers: Multiplication, Division, and Order 26 Integers: Multiplication, Division, and Order Integer multiplication and division are extensions of whole number multiplication and division. In multiplying and dividing integers, the one new issue

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

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

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

Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1

Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1 Divide: Paper & Pencil Computer Architecture ALU Design : Division and Floating Point 1001 Quotient Divisor 1000 1001010 Dividend 1000 10 101 1010 1000 10 (or Modulo result) See how big a number can be

More information

ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

ECE 0142 Computer Organization. Lecture 3 Floating Point Representations ECE 0142 Computer Organization Lecture 3 Floating Point Representations 1 Floating-point arithmetic We often incur floating-point programming. Floating point greatly simplifies working with large (e.g.,

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

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

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

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

THE BINARY NUMBER SYSTEM

THE BINARY NUMBER SYSTEM THE BINARY NUMBER SYSTEM Dr. Robert P. Webber, Longwood University Our civilization uses the base 10 or decimal place value system. Each digit in a number represents a power of 10. For example, 365.42

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

Chapter 2. Binary Values and Number Systems

Chapter 2. Binary Values and Number Systems Chapter 2 Binary Values and Number Systems Numbers Natural numbers, a.k.a. positive integers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative numbers A

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

Section 4.1 Rules of Exponents

Section 4.1 Rules of Exponents Section 4.1 Rules of Exponents THE MEANING OF THE EXPONENT The exponent is an abbreviation for repeated multiplication. The repeated number is called a factor. x n means n factors of x. The exponent tells

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

Session 29 Scientific Notation and Laws of Exponents. If you have ever taken a Chemistry class, you may have encountered the following numbers:

Session 29 Scientific Notation and Laws of Exponents. If you have ever taken a Chemistry class, you may have encountered the following numbers: Session 9 Scientific Notation and Laws of Exponents If you have ever taken a Chemistry class, you may have encountered the following numbers: There are approximately 60,4,79,00,000,000,000,000 molecules

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

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

CPEN 214 - Digital Logic Design Binary Systems

CPEN 214 - Digital Logic Design Binary Systems CPEN 4 - Digital Logic Design Binary Systems C. Gerousis Digital Design 3 rd Ed., Mano Prentice Hall Digital vs. Analog An analog system has continuous range of values A mercury thermometer Vinyl records

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

Chapter 4 -- Decimals

Chapter 4 -- Decimals Chapter 4 -- Decimals $34.99 decimal notation ex. The cost of an object. ex. The balance of your bank account ex The amount owed ex. The tax on a purchase. Just like Whole Numbers Place Value - 1.23456789

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

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

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

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

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

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

Recall the process used for adding decimal numbers. 1. Place the numbers to be added in vertical format, aligning the decimal points.

Recall the process used for adding decimal numbers. 1. Place the numbers to be added in vertical format, aligning the decimal points. 2 MODULE 4. DECIMALS 4a Decimal Arithmetic Adding Decimals Recall the process used for adding decimal numbers. Adding Decimals. To add decimal numbers, proceed as follows: 1. Place the numbers to be added

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

3.3 Addition and Subtraction of Rational Numbers

3.3 Addition and Subtraction of Rational Numbers 3.3 Addition and Subtraction of Rational Numbers In this section we consider addition and subtraction of both fractions and decimals. We start with addition and subtraction of fractions with the same denominator.

More information

Binary Numbering Systems

Binary Numbering Systems Binary Numbering Systems April 1997, ver. 1 Application Note 83 Introduction Binary numbering systems are used in virtually all digital systems, including digital signal processing (DSP), networking, and

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

Numerical Matrix Analysis

Numerical Matrix Analysis Numerical Matrix Analysis Lecture Notes #10 Conditioning and / Peter Blomgren, blomgren.peter@gmail.com Department of Mathematics and Statistics Dynamical Systems Group Computational Sciences Research

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

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

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

Zuse's Z3 Square Root Algorithm Talk given at Fall meeting of the Ohio Section of the MAA October 1999 - College of Wooster

Zuse's Z3 Square Root Algorithm Talk given at Fall meeting of the Ohio Section of the MAA October 1999 - College of Wooster Zuse's Z3 Square Root Algorithm Talk given at Fall meeting of the Ohio Section of the MAA October 1999 - College of Wooster Abstract Brian J. Shelburne Dept of Math and Comp Sci Wittenberg University In

More information

Attention: This material is copyright 1995-1997 Chris Hecker. All rights reserved.

Attention: This material is copyright 1995-1997 Chris Hecker. All rights reserved. Attention: This material is copyright 1995-1997 Chris Hecker. All rights reserved. You have permission to read this article for your own education. You do not have permission to put it on your website

More information

CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011

CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011 CS101 Lecture 11: Number Systems and Binary Numbers Aaron Stevens 14 February 2011 1 2 1 3!!! MATH WARNING!!! TODAY S LECTURE CONTAINS TRACE AMOUNTS OF ARITHMETIC AND ALGEBRA PLEASE BE ADVISED THAT CALCULTORS

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

Accuplacer Arithmetic Study Guide

Accuplacer Arithmetic Study Guide Accuplacer Arithmetic Study Guide Section One: Terms Numerator: The number on top of a fraction which tells how many parts you have. Denominator: The number on the bottom of a fraction which tells how

More information

DECIMAL COMPETENCY PACKET

DECIMAL COMPETENCY PACKET DECIMAL COMPETENCY PACKET Developed by: Nancy Tufo Revised: Sharyn Sweeney 2004 Student Support Center North Shore Community College 2 In this booklet arithmetic operations involving decimal numbers are

More information

Section 1.5 Exponents, Square Roots, and the Order of Operations

Section 1.5 Exponents, Square Roots, and the Order of Operations Section 1.5 Exponents, Square Roots, and the Order of Operations Objectives In this section, you will learn to: To successfully complete this section, you need to understand: Identify perfect squares.

More information

Lecture 8: Binary Multiplication & Division

Lecture 8: Binary Multiplication & Division Lecture 8: Binary Multiplication & Division Today s topics: Addition/Subtraction Multiplication Division Reminder: get started early on assignment 3 1 2 s Complement Signed Numbers two = 0 ten 0001 two

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

Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8

Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8 Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8 January 22, 2013 Name: Grade /10 Introduction: In this lab you will write, test, and execute a number of simple PDP-8

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

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T) Unit- I Introduction to c Language: C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating

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

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

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

MATHS ACTIVITIES FOR REGISTRATION TIME

MATHS ACTIVITIES FOR REGISTRATION TIME MATHS ACTIVITIES FOR REGISTRATION TIME At the beginning of the year, pair children as partners. You could match different ability children for support. Target Number Write a target number on the board.

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

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

Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems

Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems This assignment is designed to familiarize you with different numbering systems, specifically: binary, octal, hexadecimal (and decimal)

More information

QM0113 BASIC MATHEMATICS I (ADDITION, SUBTRACTION, MULTIPLICATION, AND DIVISION)

QM0113 BASIC MATHEMATICS I (ADDITION, SUBTRACTION, MULTIPLICATION, AND DIVISION) SUBCOURSE QM0113 EDITION A BASIC MATHEMATICS I (ADDITION, SUBTRACTION, MULTIPLICATION, AND DIVISION) BASIC MATHEMATICS I (ADDITION, SUBTRACTION, MULTIPLICATION AND DIVISION) Subcourse Number QM 0113 EDITION

More information

Fractions Packet. Contents

Fractions Packet. Contents Fractions Packet Contents Intro to Fractions.. page Reducing Fractions.. page Ordering Fractions page Multiplication and Division of Fractions page Addition and Subtraction of Fractions.. page Answer Keys..

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

The BBP Algorithm for Pi

The BBP Algorithm for Pi The BBP Algorithm for Pi David H. Bailey September 17, 2006 1. Introduction The Bailey-Borwein-Plouffe (BBP) algorithm for π is based on the BBP formula for π, which was discovered in 1995 and published

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

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

1.6 The Order of Operations

1.6 The Order of Operations 1.6 The Order of Operations Contents: Operations Grouping Symbols The Order of Operations Exponents and Negative Numbers Negative Square Roots Square Root of a Negative Number Order of Operations and Negative

More information

Negative Integer Exponents

Negative Integer Exponents 7.7 Negative Integer Exponents 7.7 OBJECTIVES. Define the zero exponent 2. Use the definition of a negative exponent to simplify an expression 3. Use the properties of exponents to simplify expressions

More information

Sample Fraction Addition and Subtraction Concepts Activities 1 3

Sample Fraction Addition and Subtraction Concepts Activities 1 3 Sample Fraction Addition and Subtraction Concepts Activities 1 3 College- and Career-Ready Standard Addressed: Build fractions from unit fractions by applying and extending previous understandings of operations

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

5.1 Radical Notation and Rational Exponents

5.1 Radical Notation and Rational Exponents Section 5.1 Radical Notation and Rational Exponents 1 5.1 Radical Notation and Rational Exponents We now review how exponents can be used to describe not only powers (such as 5 2 and 2 3 ), but also roots

More information