# Presented By: Ms. Poonam Anand

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Presented By: Ms. Poonam Anand

2 Know the different types of numbers Describe positional notation Convert numbers in other bases to base 10 Convert base 10 numbers into numbers of other bases Describe the relationship between bases 2, 8, and 16 Fractions Negative Numbers Representation Floating Point Numbers Representation

3 Number categories Many categories: natural, negative, rational, irrational and many others important to mathematics but irrelevant to the understanding of computing Number unit belonging to an abstract mathematical system and subject to specified laws of succession, addition and multiplication Natural number is the number 0 or any other number obtained adding repeatedly 1 to this number. A negative number is less than 0 and it is opposite in sign to a positive number. An integer is any of positive or negative natural numbers A rational number is an integer or the quotient of any two integer numbers is a value that can be expressed as a fraction

4 The base of number system represents the number of digits that are used in the system. The digits always begin with 0 and continue through one less than the base Examples: There are two digits in base two (0 and 1) There are eight digits in base 8 (0 through 7) There are 10 digits in base 10 (0 through 9) The base determines also what the position of the digits mean

5 It is a system of expressing numbers in which the digits are arranged in succession and, the position of each digit has a place value and the number is equal to the sum of the products of each digit by its place value Example: Consider the number 954: 9 * * * 10 0 = 954 Polynomial representation - formal way of representing numbers, where X is the base of the number: 9 * X * X * X 0 Formal representation consider that the base of representation is B and the number has n digits, where d i represents the digit in the ith position. d n * B n-1 + d n-1 * B n d 2 B +d is: 6 3 * * * 10 0

6 What if 642 has the base of 13? + 6 x 13² = 6 x 169 = x 13¹ = 4 x 13 = x 13º = 2 x 1 = 2 = 1068 in base in base 13 is equivalent to 1068 in base 10

7 Decimal base has 10 digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) Binary is base 2 and has two digits (0 and 1) Octal is base 8 and has 8 digits (0, 1, 2, 3, 4, 5, 6, 7) Hexadecimal is base 16 and has 16 digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F)

8 What is the decimal equivalent of octal number 642? 6 x 8² = 6 x 64 = x 8¹ = 4 x 8 = x 8º = 2 x 1 = 2 = 418 in base 10 Remember that octal base has only 8 digits (0, 1, 2, 3, 4, 5, 6, 7)

9 What is the decimal equivalent of the hexadecimal number DEF? D x 16² = 13 x 256 = E x 16¹ = 14 x 16 = F x 16º = 15 x 1 = 15 = 3567 in base 10 Remember that hexadecimal base has 16 digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F)

10 What is the equivalent decimal of the binary number? 1 x 2 4 = 1 x 16 = x 2 3 = 0 x 8 = x 2 2 = 1 x 4 = x 2 1 = 1 x 2 = x 2 0 = 0 x 1 = 0 = 22 in base 10 Remember that binary base has only 2 digits (0, 1)

11 What is octal number 11 in decimal representation? A. 7 B. 8 C. 9 D. I don t know

12 What is the decimal representation of binary number 1110? A. 8 B. 14 C. 16 D. I don t know

13 What is decimal representation of hexadecimal number FF? A. 10 B. 255 C. 256 D. I don t know

14 The rules of arithmetic are analogous in other basis as in decimal base Should read 1+1=0 with a carry of 1 similar to base 10 where = 0 with a carry of 1 = 10 Addition can be stated as 1 with a borrow of 1. Leading 1 we consider to be the sign, so 11 means -1 Subtraction

15 Base 2: 1+1 operation - the rightmost digit reverts to 0 and there is a carry into the next position to the left We can check if the answer is correct by converting the both operands in base 10, adding them and comparing the result Carry Values

16 The rules of the decimal base applies to binary as well. To be able to calculus 0-1, we have to borrow one from the next left digit. More precisely, we have to borrow one power of the base You can check if the result is correct by converting the operands in decimal and making the calculus.

17 Add 4 bit number 0100 with The answer is: A B C D. I don t know

18 Subtract 4 bit number 0100 from The answer is: A B C D. I don t know

19 Binary and octal numbers have a very special relation between them: given a binary number, can be read in octal and given an octal number can be read in binary (i.e. have 753 in octal, in binary you have by replacing each digit by its binary representation) Table represents counting in binary with octal and decimal representation Binary Octal Decimal

20 Start at the rightmost binary digit and mark the digits in groups of three Convert each group individually is 253 in base 8 The reason that binary can be immediately converted in octal and vice-versa is because 8 is power of 2 There is a similar relationship between binary and hexadecimal

21 Start at the rightmost binary digit and mark the digits in groups of four Convert each group individually A B is AB in base 16

22 Involves dividing by the base into which you convert the number Algorithm: Dividing the number by the base you get a quotient and a reminder While the quotient is not zero: Divide the decimal number by the new base Make the remainder the next digit to the left in the answer Replace the original dividend with the quotient The base 10 number 3567 is what number in base 16?

23 3567 in decimal is DEF in hexadecimal D E F

24 Modern computers are binary machines A digit in binary system is either 0 or1 The binary values in a computer are encoded using voltage levels: 0 is represented by a 0V signal (or low voltage) 1 is represented by a 5V signal (i.e. in TTL logic), or by a high voltage signal. Bit is a short expression for binary digit Byte eight binary digits Word a group of one or more bytes; the number of bits in a word is the word length in a computer

25 Convert number to hexadecimal. The answer is: A. CF B. BF C. FC D. I don t know

26 Convert decimal number 375 to its octal representation. The answer is A. 567 B. 765 C. 556 D. I don t know

27 Convert decimal number 37 to its binary representation. The answer is: A B C D. I don t know

28 Representation and conversion of fractional numbers is more difficult because there is not necessarily an exact relationship between fractional numbers in different number bases. Fractional numbers that can be represented exactly in one number base, may be impossible to represent exactly in another Example: The decimal fraction 1/3 is not represent-able as a decimal value in base 10: ; this can be represented exactly in base 3 as The decimal fraction 1/10 (or ) cannot be represented exactly in binary form. The binary equivalent begins:

29 The strength of each digit is B times the strength of its right neighbor (where B is the base for a given number). If we move the number point to the right, the value of the number will be multiplied by the base: is 10 times as large as The is twice as big as 10 2 The opposite is also true if we move the number point to the left one place, then the value is divided by the base A given number.d 1 D 2 D 3 D n will be represented as: D 1 * B -1 + D 2 * B -2 + D 3 * B D n B -n = 2 * (1/10) + 5 * (1/100) + 8 * (1/1000) + 9 * (1/10000) = (½) + (1/8) + (1/32) + (1/64)

30 The intuitive method: Determine the appropriate weights for each digit, multiply each digit by its weight and then add the values Example: convert to base 10 = (1/3) + 2 * (1/9) + 2 * (1/27) + (1/243) = Convert the number in a natural number (and record what was the multiplier) and then divide the result by the multiplier Example: convert to base 10 shifting the binary point six places to the right and converting, we have: = 51; shifting the point back is the equivalent of 2 6 or 64, so we can obtain the final number by dividing 51 to 64 = Variation of the division method shown earlier: we multiply the fraction by the base value, repeatedly, and record, then drop the values that move to the left of the point. This is repeated until the level of accuracy is obtained or until the value being multiplied is zero

31 The 1 is saved as result then dropped and the process repeated * * * * * *

32 The conversion between bases where one base is an integer power of the other can be performed for fractions by grouping the digits in the smaller base as before For fractions, the grouping must be done from the left to right; the method is otherwise identical Example: Convert to base 8: 0.101_110 = Convert to base 16: _1010 = 0.EA 16

33 Convert binary number 0.11 to its decimal value. The answer is: A. 0.1 B. 0.5 C D. I don t know

34 Convert decimal number 0.33 in it binary representation. Use maximum 8 bit precision after the point. The result is: A B C D. I don t know

35 Consider binary number Compute its decimal value. The answer is: A B C. 0.5 D. I don t know

36 Are the negative numbers just numbers with a minus sign in the front? This is probably true but there are issues to represent negative numbers in computing systems Common schemas: Sign-magnitude Complementary representations: 1 s complement 2 s complement most common & important

37 Left most bit used to represent sign 0 = positive value 1 = negative value behaves like a flag It is important to decide how many bits we will use to represent the number Example: Representing +5 and -5 on 8 bits: +5: : So the very first step we have to decide on the number of bits to represent number

38 Two representations of zero Using 8-bit sign-magnitude 0: : Arithmetic is awkward! 8-bit sign-magnitude: = = (it requires a different algorithm, can t just add and carry, meaning more complexity in hardware in order to implement an ALU)

39 9 s (Decimal) complement 1 s (Binary) complement 10 s (Decimal) complement 2 s (Binary) complement

40 Decide on the number of digits (word length) to represent numbers Then represent the negative numbers by the largest number minus the absolute value of the negative number. Example: 2-digit 9 s complement of = 87 To get back the abs value, invert again; i.e = 12 Most negative number: representation original number

41 Two representations of zero Using 2-digit 9 s complement 0: 00 0: 99 Arithmetic is still a little awkward, meaning that complex hardware will be required to build arithmetic units for this logic. Represented Number Original Number 9's Decimal Complement for two digit numbers

42 Decide on the number of bits (word length) to represent numbers Then represent the negative numbers by the largest number minus the absolute value of the negative number. Example: 8-digit 1 s complement of = ( = (2 8 1) 5 in base 10) Notice: very easy: flip or invert the 1 s and 0 s to compute 1 s complement of a number To get back the abs value, invert again Most negative: representation original number

43 Two representations of zero Using 6-digit 1 s complement 0: : Arithmetic is still a little awkward! Represented Number Original Number 1's binary complement for 8 digit numbers

44 Again decide on the number of bits (word length) to represent numbers Then represent the negative numbers by the [largest number+1] minus the absolute value of the negative number Example 2-digit 10 s complement of = 88 To get back the abs value, invert again; i.e = 12 Most negative number: representation original number

45 Notice: unique representation of 0 10 s complement = 9 s complement +1 Represented Number Original Number 10's Complement for two digit numbers

46 It is similar to 10 s complement representation for decimal. Decide on the number of digits (word length) to represent numbers Then represent the negative numbers by the [largest number + 1] minus the absolute value of the negative number. Example: 8-digit 2 s complement of = ( = in base 10) To get back the abs value, subtract again from 2 8

47 The 2 s complement of a number can be found in two ways Subtract the value from the modulus [largest number +1] Find 1 s complement (by inverting the value) and adding 1 to the result (2 complement = 1 s complement +1) Represented Number Original Number 2's complement for 8 digit numbers

48 Both methods are used in computer design 1 s complement offers a simpler method to change the sign of a number Requires an extra end-around carry step Algorithm must test for and convert -0 to 0 at the and of each operation. 2 s complement Simplifies the addition operation Additional add operation required every time a sign change is required (by inverting and adding 1)

49 Positive numbers are always represented by themselves Small negative numbers (close to 0) have representations that start with large numbers of 1 s. The number -2 in 8 bit 2 s complement is represented as Since there is only a difference in value of 1 between 1 s and 2 s complement representations of negative numbers (of course the positive representations are always the same), you could get a quick idea of the value (in either of the representations) by inverting all the 1 s and 0 s and approximating the value from the result

50 Consider 8 bit representation. What would decimal number 9 be represented in 2 s complement? A B C D. I don t know

51 Consider 8 bit representation. The 2 s complement representation of decimal number -9 is: A B C D. I don t know

52 What is the minimum number of digits required to represent decimal negative number -7? A. 3 B. 4 C. 2 D. I don t know

53 Overflow occurs when the result of the calculation doesn t fit into the fixed number of bits available for the result. In 2 s complement, an addition or subtraction overflow occurs whenever the result overflows into the sign bit if the sign of the result is different then the sign of the both operands In addition, the computing systems provide for an carry flag that is used to correct for carries and borrows that occurs when large number have to be separated into parts to perform additions and subtractions. Example: CPU has only 32 bit wide instructions, but has to add 64 bit numbers The 64 bit number are divided in two 32 bits parts, the least significant 32 bit parts are added with carry, and the most significant parts are added using also as input any carry that was generated from the previous addition operation. Carry and overflow are occurring independently of each other: Carry occurs when a result of an addition or subtraction exceeds the fixed number of bits allocated, without regard to sign. Overflow occurs whenever the result is incorrect

54 (+4) + (+2) = (+6) no overflow no carry the result is correct (-4) + (-2) = (-6) no overflow carry Ignoring the carry, the result is correct (+4) + (+6) = (-6) overflow no carry the result is incorrect (-4) + (-6) = (+6) overflow carry Ignoring the carry, the result is incorrect

55 Binary Hex Unsigned Signed (1) xa x2d =========== ==== === === xd C = 0 V = 0 (2) xd xf =========== ==== === === x1c C = 1 V = 0 (3) x2d x =========== ==== === === x C = 0 V = 1 (4) xd xa =========== ==== === === x17b C = 1 V = 1 Note: Producing a carry, C = 1, indicates unsigned overflow. Producing a carry, C = 1, does not indicate signed overflow. To recognize signed overflow, two conditions must be present: The operands must have the same sign, and the sum must have the opposite sign.

56 The range of 8 bit unsigned number is: A. 0 to 256 B. 0 to 255 C. 0 to 128 D. I don t know

57 The range of a 8 bit signed number represented in 2 s complement is: A to 127 B. 0 to 255 C to 128 D. I don t know

58 Real or floating point number are used in computing systems when the number to be expressed is outside of the integer range or when the number contains a decimal fraction The number is represented by a fixed number of digits of precision together with a power that shifts the point to make the number larger or smaller We need to understand the properties of floating point numbers, how they are represented and how calculations are performed First, as usual, we will present the techniques in base 10, since working with decimal numbers is more familiar. Then we will extend the discussion to binary numbers.

59 Consider the number Here are a number of alternative representations: * * * * 10 7 ( OR * 10 7 if we have limited digits of magnitude) The way of representing the above number is known as exponential notation (scientific notation)

60 Four components are required to define a number using this notation: The sign of the number (+ in our example) The magnitude of the number (known as mantissa, in our example) The sign of the exponent (+ in our example) The magnitude of the exponent (say it is 3) Two additional pieces of information are required to complete the representation: The base of the exponent (in this case 10) in the computer is usually specified to be 2. The location of the decimal (or binary point if we are working in base 2) point in the computer the binary point is set at a particular location in the number, most common at the beginning or the end of the number. Since its location never changes, it is not necessary to actually store the point. Knowing the location of the point is essential In our example, the location of the decimal point was not specified, so reading the data suggests that the number might be * 10 3, which is wrong. The actual placement of the decimal point should be * 10 3

61 The number to be represented is One possible representation of this number is: x 10-6 Exponent Sign of mantissa Location of decimal point Mantissa Sign of exponent Base

62 Typical representation is using 8 digits: SEEMMMMM, where: S one digit for the sign of the mantissa EE two digits for the exponent MMMMM- the mantissa representation There is no provision for the sign of the exponent. Use some method that includes it: One method, is to use complementary representation for the exponent Other method is to use an offset representation: if we pick a value somewhere in the middle of the possible values of the exponent (0-99), say 50 and declare that this value corresponds to 0, then every value lower than that will be negative and those above will be positive.

63 This method is know as Excess-N notation, where N is the chosen midvalue It is simpler to use for exponents than the complementary form and appropriate for the calculations required on exponents Allows to store an exponential range of -50 to 49 If we assume that the decimal point is located at the beginning of the five digit mantissa, excess-50 notation allows us magnitude range of * < number< * Representation Exponent being represented Scale for the offset technique

64 Overflow using/resulting a number of magnitude to large to be stored Underflow - where the number is a decimal fraction with of magnitude to small to be stored * * * * Overflow region Underflow region Overflow region

65 The exponent is represented in excess of 50. The computer is aware of storing only numbers, no signs nor position of the decimal point. Decimal point is at the beginning of the mantissa Sign is represented as: 0 a positive sign, 5 represents a negative sign (arbitrary representation in base 10) = * 10 3 = = * 10-2 = = * 10 5 = = * 10-1 = 0.025

66 The number of digits used will be determined by the desired precision To maximize precision for a given number of digits, numbers will be stored with no leading zeros. Normalization when necessary, numbers are shifted left by increasing the exponent until leading zeros are eliminated Example our format will consist of a sign, five digits with the decimal point located at the beginning of the number and two exponent digits:.mmmmm * 10 EE

67 Normalization ( ) 1. Provide an exponent of 0 for the number if an exponent wasn t already specified ( * 10 0 ) 2. Shift the decimal point left or right by increasing or decreasing the exponent, until the decimal point is in the proper position ( * 10 3 ) 3. Shift the decimal point right, if necessary, until there are no leading zeros in the mantissa (no adjustment required) 4. Correct the precision by adding or discarding digits as necessary, to meet the specification ( * 10 3 ) Formatting:

68 Consider the representation described so far (SEEMMMMM, exponent represented in excess of 50, decimal point located at the beginning of the mantissa, sign + represented by digit 0 and sign represented by digit 5), the number represents: A B C D. I don t know

69 Consider the representation described so far (SEEMMMMM, exponent represented in excess of 50, decimal point located at the beginning of the mantissa, sign + represented by digit 0 and sign represented by digit 5), the number is represented as: A B C D. I don t know

70 The leading bit of the mantissa must be 1 if the number is normalized The leading bit can be treated implicitly (similar with the binary point) Disadvantages: Leading bit is always 1, means that we can represent too small numbers, limiting the small end of the range Any format that might require a 0 in the leading bit can t be represented This method requires that we provide a separate way to store the number 0.0, since the requirement to have the leading bit 1, makes the mantissa 0.0 an impossibility The additional bit doubles the available precision of the mantissa, the slightly narrowed range is usually and acceptable trade off. The number 0.0 is represented by selecting a particular 32 bit word and assigning it the value 0.0.

71 Most common standard for representing floating point numbers Single precision: 32 bits, consisting of... Sign bit (1 bit) Exponent (8 bits) Mantissa (23 bits) Double precision: 64 bits, consisting of Sign bit (1 bit) Exponent (11 bits) Mantissa (52 bits)

72 32 bits Mantissa (23 bits) Exponent (8 bits) Sign of mantissa (1 bit)

73 The mantissa is normalized Has an implied 1 on left of the point. Normalized form of the mantissa is 1.MMMMM Example: Mantissa: Representation: = Note: convert each side of the point using techniques described in previous lectures

74 The exponent is formatted using excess- 127 notation, with an implied base of 2 Example: Exponent: Representation: = 8 The stored values 0 and 255 of the exponent are used to indicate special values, the exponential range is restricted to to The number 0.0 is defined by a mantissa of 0 together with the special exponential value 0 The standard allows also values +/- (represented as mantissa +/-0 and exponent 255

75 64 bits Mantissa (54 bits) Exponent (11 bits) Sign of mantissa (1 bit)

76 Same format as single precision floating point representation Excess-1023 exponent representation An implied base of 2 and an implied most significant bit at the left of an implied binary point Range of more than to

77 The whole and fractional parts of numbers with and embedded decimal or binary point must be converted separately Numbers in exponential form must be reduced to a pure decimal or binary mixed number or fraction before the conversion can be performed

78 Decimal value of 32 bit floating point number: Mantissa: = Mantissa conversion: 1. First the whole number: 1 2 = Then the fractional number: = ½ + ¼ + 1/8 + 1/16 + 1/64 + 1/128 = ( )/128 = Exponent: = (because is excess-127) = 3 Sign: 1 (negative number) Answer: * 2 3 =

79 Express 3.14 as 32 bit floating point number Note: use 10 significant bits for the mantissa Normalize the number Convert the whole and fractional parts independently 3 10 = = , this is obtained using the multiplication method presented in one of the previous lecturers (see the next slide) = * 2 The exponent is 1, represented in excess-127 is: the mantissa is The sign is positive (0) Answer:

80 0.14 * * * * * * * * * * *

81 On the computer, more difficult than integers Addition & Subtraction: need to line up the exponents (by making the smaller one to match the larger one, moving the point in the mantissa) and perform addition on the mantissa Multiplication & Division need to do separate operations to mantissa and exponent: multiply/divide mantissa and correspondingly add/subtract and adjust the exponent

82 Perform the addition Convert the numbers in floating point representation First Operand N1 = 3 10 = 11 2 N1 = = * 2 1 The exponent is E1 = 1, represented in excess-127 is: The mantissa is M1 = The sign is positive (0) Second Operand N2 = = 1.1 2, this is obtained using the multiplication method presented in one of the previous lecturers N2 = = * 2 0 The exponent is E2 = 0, represented in excess-127 is:

83 In order to perform the addition, we need to line up the exponents (by making the smaller one to match the larger one, moving the point in the mantissa) and perform addition on the mantissa E1 is the largest exponent, so we will make the modifications on the second number: E2 = 1 ( ) M2 = Perform the addition on the mantissas: M1 + M2 = Remember that the common exponent is We need to normalize again the result, so the mantissa of the resulting number is M = 1.001, and the exponent of the result is E = The answer is

84 Perform the multiplication 3 10 * Convert the numbers in floating point representation First Operand N1 = 3 10 = 11 2 N1 = = * 2 1 The exponent is E1 = 1, represented in excess-127 is: The mantissa is M1 = The sign is positive (0) Second Operand N2 = = 1.1 2, this is obtained using the multiplication method presented in one of the previous lecturers N2 = = * 2 0 The exponent is E2 = 0, represented in excess-127 is:

85 We need to do separate operations to mantissa and exponent: multiply/divide mantissa M1 * M2 = 1.1 * 1.1 = * correspondingly add/subtract and adjust the exponent E1 + E2-127 = = = Normalize the number: M = E = Resulting number: The resulting number is representation

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

### Binary Numbers. Bob Brown Information Technology Department Southern Polytechnic State University

Binary Numbers Bob Brown Information Technology Department Southern Polytechnic State University Positional Number Systems The idea of number is a mathematical abstraction. To use numbers, we must represent

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

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

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

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

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

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

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

### Signed Binary Arithmetic

Signed Binary Arithmetic In the real world of mathematics, computers must represent both positive and negative binary numbers. For example, even when dealing with positive arguments, mathematical operations

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

### 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.,

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

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

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

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

### 198:211 Computer Architecture

198:211 Computer Architecture Topics: Lecture 8 (W5) Fall 2012 Data representation 2.1 and 2.2 of the book Floating point 2.4 of the book 1 Computer Architecture What do computers do? Manipulate stored

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

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

### CHAPTER 3 Numbers and Numeral Systems

CHAPTER 3 Numbers and Numeral Systems Numbers play an important role in almost all areas of mathematics, not least in calculus. Virtually all calculus books contain a thorough description of the natural,

### Number Systems I. CIS008-2 Logic and Foundations of Mathematics. David Goodwin. 11:00, Tuesday 18 th October

Number Systems I CIS008-2 Logic and Foundations of Mathematics David Goodwin david.goodwin@perisic.com 11:00, Tuesday 18 th October 2011 Outline 1 Number systems Numbers Natural numbers Integers Rational

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

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

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

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

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

### Decimal Numbers: Base 10 Integer Numbers & Arithmetic

Decimal Numbers: Base 10 Integer Numbers & Arithmetic Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 )+(1x10 0 ) Ward 1 Ward 2 Numbers: positional notation Number

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

### ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-470/570: Microprocessor-Based System Design Fall 2014.

REVIEW OF NUMBER SYSTEMS Notes Unit 2 BINARY NUMBER SYSTEM In the decimal system, a decimal digit can take values from to 9. For the binary system, the counterpart of the decimal digit is the binary digit,

### 4 Operations On Data

4 Operations On Data 4.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, students should be able to: List the three categories of operations performed on

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

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

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

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

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

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

### Simulation & Synthesis Using VHDL

Floating Point Multipliers: Simulation & Synthesis Using VHDL By: Raj Kumar Singh - B.E. (Hons.) Electrical & Electronics Shivananda Reddy - B.E. (Hons.) Electrical & Electronics BITS, PILANI Outline Introduction

### Fractional Numbers. Fractional Number Notations. Fixed-point Notation. Fixed-point Notation

2 Fractional Numbers Fractional Number Notations 2010 - Claudio Fornaro Ver. 1.4 Fractional numbers have the form: xxxxxxxxx.yyyyyyyyy where the x es constitute the integer part of the value and the y

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

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

### The Essentials of Computer Organization and Architecture. Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003

The Essentials of Computer Organization and Architecture Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003 Chapter 2 Instructor's Manual Chapter Objectives Chapter 2, Data Representation,

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

### Binary Numbers The Computer Number System

Binary Numbers The Computer Number System Number systems are simply ways to count things. Ours is the base-0 or radix-0 system. Note that there is no symbol for 0 or for the base of any system. We count,2,3,4,5,6,7,8,9,

### This 3-digit ASCII string could also be calculated as n = (Data[2]-0x30) +10*((Data[1]-0x30)+10*(Data[0]-0x30));

Introduction to Embedded Microcomputer Systems Lecture 5.1 2.9. Conversions ASCII to binary n = 100*(Data[0]-0x30) + 10*(Data[1]-0x30) + (Data[2]-0x30); This 3-digit ASCII string could also be calculated

### COMPASS Numerical Skills/Pre-Algebra Preparation Guide. Introduction Operations with Integers Absolute Value of Numbers 13

COMPASS Numerical Skills/Pre-Algebra Preparation Guide Please note that the guide is for reference only and that it does not represent an exact match with the assessment content. The Assessment Centre

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

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

### Restoring division. 2. Run the algorithm Let s do 0111/0010 (7/2) unsigned. 3. Find remainder here. 4. Find quotient here.

Binary division Dividend = divisor q quotient + remainder CS/COE447: Computer Organization and Assembly Language Given dividend and divisor, we want to obtain quotient (Q) and remainder (R) Chapter 3 We

### Data Storage 3.1. Foundations of Computer Science Cengage Learning

3 Data Storage 3.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List five different data types used in a computer. Describe how

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

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

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

### Chapter 6 Digital Arithmetic: Operations & Circuits

Chapter 6 Digital Arithmetic: Operations & Circuits Chapter 6 Objectives Selected areas covered in this chapter: Binary addition, subtraction, multiplication, division. Differences between binary addition

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

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

### > 2. Error and Computer Arithmetic

> 2. Error and Computer Arithmetic Numerical analysis is concerned with how to solve a problem numerically, i.e., how to develop a sequence of numerical calculations to get a satisfactory answer. Part

### Representation of Floating Point Numbers in

Representation of Floating Point Numbers in Single Precision IEEE 754 Standard Value = N = (-1) S X 2 E-127 X (1.M) 0 < E < 255 Actual exponent is: e = E - 127 sign 1 8 23 S E M exponent: excess 127 binary

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

### = Chapter 1. The Binary Number System. 1.1 Why Binary?

Chapter 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-0 system. When you

### Number Systems, Base Conversions, and Computer Data Representation

, Base Conversions, and Computer Data Representation Decimal and Binary Numbers When we write decimal (base 10) numbers, we use a positional notation system. Each digit is multiplied by an appropriate

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

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

### Number and codes in digital systems

Number and codes in digital systems Decimal Numbers You are familiar with the decimal number system because you use them everyday. But their weighted structure is not understood. In the decimal number

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

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

### quotient = dividend / divisor, with a remainder Given dividend and divisor, we want to obtain quotient (Q) and remainder (R)

Binary division quotient = dividend / divisor, with a remainder dividend = divisor quotient + remainder Given dividend and divisor, we want to obtain quotient (Q) and remainder (R) We will start from our

### Sometimes it is easier to leave a number written as an exponent. For example, it is much easier to write

4.0 Exponent Property Review First let s start with a review of what exponents are. Recall that 3 means taking four 3 s and multiplying them together. So we know that 3 3 3 3 381. You might also recall

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

Modbus Frequently Asked Questions WP-34-REV0-0609-1/7 The Answer to the 14 Most Frequently Asked Modbus Questions Exactly what is Modbus? Modbus is an open serial communications protocol widely used in

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

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

### 1.3 Order of Operations

1.3 Order of Operations As it turns out, there are more than just 4 basic operations. There are five. The fifth basic operation is that of repeated multiplication. We call these exponents. There is a bit

### Integer multiplication

Integer multiplication Suppose we have two unsigned integers, A and B, and we wish to compute their product. Let A be the multiplicand and B the multiplier: A n 1... A 1 A 0 multiplicand B n 1... B 1 B

### Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

Chapter 3 Data Storage Objectives After studying this chapter, students should be able to: List five different data types used in a computer. Describe how integers are stored in a computer. Describe how

### Binary. ! You are probably familiar with decimal

Arithmetic operations in assembly language Prof. Gustavo Alonso Computer Science Department ETH Zürich alonso@inf.ethz.ch http://www.inf.ethz.ch/department/is/iks/ Binary! You are probably familiar with

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

### INTEGER DIVISION BY CONSTANTS

12/30/03 CHAPTER 10 INTEGER DIVISION BY CONSTANTS Insert this material at the end of page 201, just before the poem on page 202. 10 17 Methods Not Using Multiply High In this section we consider some methods

### Lecture N -1- PHYS 3330. Microcontrollers

Lecture N -1- PHYS 3330 Microcontrollers If you need more than a handful of logic gates to accomplish the task at hand, you likely should use a microcontroller instead of discrete logic gates 1. Microcontrollers

### HOMEWORK # 2 SOLUTIO

HOMEWORK # 2 SOLUTIO Problem 1 (2 points) a. There are 313 characters in the Tamil language. If every character is to be encoded into a unique bit pattern, what is the minimum number of bits required to

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

### The University of Nottingham

The University of Nottingham School of Computer Science A Level 1 Module, Autumn Semester 2007-2008 Computer Systems Architecture (G51CSA) Time Allowed: TWO Hours Candidates must NOT start writing their

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

### 1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12

C5 Solutions 1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12 To Compute 0 0 = 00000000 To Compute 1 Step 1. Convert 1 to binary 00000001 Step 2. Flip the bits 11111110

### CS 16: Assembly Language Programming for the IBM PC and Compatibles

CS 16: Assembly Language Programming for the IBM PC and Compatibles First, a little about you Your name Have you ever worked with/used/played with assembly language? If so, talk about it Why are you taking

### Now that we have a handle on the integers, we will turn our attention to other types of numbers.

1.2 Rational Numbers Now that we have a handle on the integers, we will turn our attention to other types of numbers. We start with the following definitions. Definition: Rational Number- any number that

### Review 1/2. CS61C Characters and Floating Point. Lecture 8. February 12, Review 2/2 : 12 new instructions Arithmetic:

Review 1/2 CS61C Characters and Floating Point Lecture 8 February 12, 1999 Handling case when number is too big for representation (overflow) Representing negative numbers (2 s complement) Comparing signed

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

### Computer Systems Architecture

Computer Systems Architecture http://cs.nott.ac.uk/ txa/g51csa/ Thorsten Altenkirch and Liyang Hu School of Computer Science University of Nottingham Lecture 09: Floating Point Arithmetic and the MIPS

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

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

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

### Copy in your notebook: Add an example of each term with the symbols used in algebra 2 if there are any.

Algebra 2 - Chapter Prerequisites Vocabulary Copy in your notebook: Add an example of each term with the symbols used in algebra 2 if there are any. P1 p. 1 1. counting(natural) numbers - {1,2,3,4,...}

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

### Chapter 7D The Java Virtual Machine

This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly

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

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