1- Introduction. Bit: The most basic unit of information in a digital computer (On/Off ; 0/1 state)
|
|
- Dustin Rice
- 7 years ago
- Views:
Transcription
1
2 Objectives: Chapter 2 : Introduction 1- Introduction 2- Positional Numbering System 3- Decimal to binary conversion 4- Signed integer representation 5- Floating-point representation 1- Introduction Bit: The most basic unit of information in a digital computer (On/Off ; 0/1 state) Byte: A set of 8bits Word: two or more adjacent bytes that are manipulated collectively Word size: The size of a word in bits depends on the computer organization (16, 32, 64 bits, ) Nibbles (or nybbles): set of 4 bits Usually a set of 8 bits is divided into two nibbles, a low order nibble and a high order nibble 1
3 2- Positional Numbering System Any numeric value is represented through increasing powers of a radix (or base) The set of valid numerals (digits) is equal in size to the radix of that system The least numeral is 0 and the highest one in 1 smaller than the radix Example: In the decimal system (base 10) The radix is 10 The number of valid numerals is 10 (equal to the radix) The set of valid numerals is: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} The most important radices (bases) in computer science) are: Binary Radix 2 or base 2 Numerals: {0, 1} Octal Radix 8 or Base 8 Numerals: {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Radix 16 or base 16 Numerals: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F} (Binary to Decimal conversion) Any numeric value is represented through increasing powers of a radix (or base) = 2x x x3 0 = = 1x x x x x x x2-2 = = 1x x x x x x x5-4 = Questions: Convert the following decimal fractions to binary with a maximum of six places to the right of the binary point: a b c d Ans a b c d
4 3- Decimal to binary conversion Keep in mind the following tables or how to obtain them! A real number can take any value (ex ; ) Whole number: No fractions (ex: 10, 1231, 3543,, -12, , ) Unsigned number: Only positive numbers (ex: , , 12357, ) Unsigned whole numbers: No fraction and only positive numbers : Division-remainder 3
5 A binary number with N bits can represent 2 N unsigned integers from 0 to 2 N -1 Example: Having N=4 bits, we can represent 2 4 = 16 unsigned integers from 0 to 2 4-1=16-1=15 The number 16 CANNOT be represented with only 4 bits!! Example: Convert to base 3 using the division-remainder method remainder of remainder of remainder of 2 (104) 10 = (10212) remainder of remainder of 1 From Down to UP. 0 Questions: 1. Perform the following base conversions using subtraction or division-remainder: a = 3 b = 5 c = 7 d = 9 e = 3 f = 5 g = 7 h = 9 Ans. a b c d a b c d
6 Converting Decimal to Binary fractions Radix points (.) separate the integer part of a number from its fractional part Example of fractions : Base 10 : Base 3 : Base 2 : The radix point is called a decimal point in a decimal system, a binary point in a binary system, and so on To convert fractions from decimal to any other base system we repeatedly multiply by the destination radix Convert to base x 5 = The integer part is 2 From UP to x 5 = The integer part is 0 Down x 5 = The integer part is x 5 = The integer part is 4 the fractional part is zero, we are done (0.4304) 10 = (0.2034) 5 Some fractions in one base could be indeterminate Fractions that contain repeating strings of digits to the right of the radix point Example: (2/3) 10 =(0.666 ) 10 An indeterminate fraction in one base could be determinate in another base (and vice-versa). Example: (2/3) 10 =0.2 3 =(0.666 ) 10-2/3 is indeterminate in base 10 but determinate in base 3. When a fraction is indeterminate, an approximation is needed We fix the number of digits to the right of the radix point Also, approximation is needed due to the limited computing resources (example: limited size of the processor s registers) 5
7 Example: Convert to binary with 4 bits to the right of the binary point x 2= The integer part is x 2= The integer part is 1 Down x 2= The integer part is x 2= The integer part is 1 ( ) 10 = (0.0101) 2 Convert the following decimal fractions to binary with a maximum of six places to the right of the binary point: a b c d Ans. a b c d Converting between Power-of-Two Radices To convert between any base to any other base (different than base 10), it is easier to pass through base 10. Example: 31214= ( )3? First step: = 3x x x x4 0 = Second step: by using the division-remainder method: = So 31214=
8 Converting from Binary to Octal Each octal digit is equivalent to a group of 3 binary digits called octet Each hexadecimal digit is equivalent to a group of 4 binary digits called hextet Example: Convert to octal 1- Make Groups of 3 bits (from right to left): Add zero(s) on the left to complete the last octet Convert each octet to its corresponding octal digit Finally: = Converting from Binary to Hexadecimal Example: Convert to hexadecimal 1- Make Groups of 4 bits (from right to left): Add zero(s) on the left to complete the last hextet Convert each hextet to its corresponding hexadecimal digit C 9 D 4- Finally: = 2C9D16 (MTA 1st Semester 2012/2013) Convert the following binary numbers to the destination base. Show your conversion steps clearly. a. ( ) 2 = (114) 8 b. ( ) 2 = (D5) 16 or (0D5) 16 7
9 4- Signed integer representation An integer is a whole number Signed integers are the set of positive and negative whole numbers How should we encode and deal with the actual sign of the number? Two concepts are used Signed Magnitude concept Complement concept Signed Magnitude Signed magnitude is the most intuitive method The MSB (Most Significant Bit) of a binary number is kept as the sign of the number MSB = 1: negative number MSB = 0: positive number The remaining bits represent the magnitude (or absolute value) of the numeric value Example: In a 8 bit word signed magnitude system give the decimal representation of the following numbers ? - The MSB is 0: The number is positive - The remaining 7 bits are: = The decimal number is ? - The MSB is 1: The number is negative - The remaining 7 bits are: = The decimal number is -1 Example: In a 8 bit word signed magnitude system give the decimal representation of the following numbers ? - The MSB is 1: The number is negative - The remaining 7 bits are: = The decimal number is ? - The MSB is 0: The number is positive - The remaining 7 bits are: = The decimal number is +65 8
10 In a N bit word signed magnitude system 1 bit is used for the sign of the number N-1 bits are used for the magnitude of the number The largest integer is 2 N-1-1 The smallest integer is -(2 N-1-1) Example: in a 8 bit word signed magnitude system The largest integer is = = The smallest integer is = -(2 7-1) = Steps that guides you to solve the Signed-magnitude arithmetic At first we look at the signs of the two operands We arrange the operands in a certain way based on their signs We perform the calculation without regard to the signs Finally, we supply the sign as appropriate 1- Adding operands that have the same sign Example: Add to using signed-magnitude arithmetic. sign carries (79) (35) (114) We find = in signed-magnitude representation. Overflow condition(important) In the last example, adding the seventh bits to the left gives no carry If there is a carry, we say that we have an overflow condition and the carry is discarded, resulting in an incorrect sum. See the Next Example for overflow condition: 9
11 Example: Add to using signed-magnitude arithmetic 1 carries (65) (97) (34) The previous addition overflows The last carry is discarded The sum s result is incorrect 2- Subtracting operands Example1: Subtract from using signedmagnitude arithmetic borrows (99) (79) (20) We find = in signed-magnitude representation. 10
12 Example 2: Subtract from using signedmagnitude arithmetic. Here the subtrahend, , is larger than the minuend, With the result obtained in Example 1, we know that the difference of these two numbers is Because the subtrahend is larger than the minuend, all that we need to do is change the sign of the difference. So we find = in signedmagnitude representation Example 3: Add to using signed-magnitude arithmetic = 13 and = -19 The result is negative We subtract 13 from 19 The result of the binary subtraction is: (-6) Example 4: Subtract (-24) from (-43) using signed-magnitude arithmetic. This is equivalent to adding -43 to 24 The result is negative We subtract 24 from 43 The result of the binary subtraction is: (-19) 11
13 General rules when operands have different signs 1- Determine which operand has the larger magnitude 2- The sign of the result is the same as the sign of the operand with the larger magnitude 3- the magnitude must be obtained by subtracting (not adding) the smaller one from the larger one Questions: Use signed magnitude arithmetic to add to (explain and show your detailed calculations clearly). Do we have an overflow? Why? = +103; = -31 we are adding a positive number to a negative one. So we should subtract 31 from 103 and the result is positive. The result is = There is no overflow because we are subtracting. No overflow occurs when subtracting (Important) -Subtract from ( ) using 8-bit signed magnitude arithmetic (explain and show your detailed calculations clearly). The result should be in signed magnitude format. What can you notice? Sol. The result is = 910 which is wrong! (you must explain) Use signed magnitude arithmetic to Calculate: - add to sum of -40 and 13 - Subtract -2 from Problems related to signed magnitude Too much decisions to make (larger number? ; borrows? ; what signs?). The number 0 could have two representations : and Complicated method Expensive circuits 12
14 Complement system Complement system is used to represent/convert negative numbers only When using complement system the subtraction is converted to an addition Advantages of complement system Simplify computer arithmetic No need to process sign bits separately The sign of a number is easily checked by looking at its high-order bit (MSB). One's Complement We say that we work in one s complement (C1) To convert a negative number to its one s complement then switching all of the 1s with 0s and vice versa!! A positive number is directly converted to its binary representation. Example: Express 2310 and -910 in 8-bit binary one s complement form = + ( ) = C1-910 = - ( ) = C1 Questions: Show the representation (assuming 8-bit registers) using signed-1's complement: a. 77 b. -42 c. 119 d. 107 Sol. One's complement: One's complement: One's complement: One's complement:
15 Subtraction and Addition in one's complement: In one s compliment the subtraction is converted into addition Example: = (-910) Example1: Add 2310 to -910 using 8-bit binary one s complement arithmetic. The result is C1 = +( ) = 1410 Example2 : Add 910 to using 8-bit binary one s complement arithmetic = - ( )2 = C1 910 = + ( ) = C (-2310) = C C1 Result: C1 = -( ) =
16 Disadvantages of one's complement In One s complement, we still have two representations for zero: and Computer engineers long ago stopped using one s complement A more efficient representation for binary numbers is the two s complement Two's Complement We say that we work in two s complement(c2) To convert a negative number to its Two's complement then convert it first to one's complement then add one A positive number is directly converted to its binary representation Example: Express 2310, -2310, and -910 in 8-bit binary two s complement form = + ( ) = c = -( ) = c1 + 1 = c2-910 = -( ) = c1 + 1 = c2 Questions: Show the representation of -16 (assuming 8-bit registers) using signed-2's complement: a. 77 b. -42 c. 119 d. 107 Sol. One's complement: One's complement: One's complement: One's complement:
17 Subtraction and Addition in two's complement: Unlike C1 arithmetic, in C2 the last carry is discarded Example 1: Add 910 to using two s complement arithmetic. The result is C2 = -( ) = Note in the previous example how a negative binary number in C2 is converted to decimal At first all 0 and 1 in the C2 s number are switched: A 1 is then added to the last number: = So C2 = -( ) = Example 2: Find the sum of 2310 and -910 in binary using two s complement arithmetic = +( )2 = C2-910 = -( ) = C (-910) = C C2 Result: C2 = +( ) =
18 Advantages of two s complement It is the most popular choice for representing signed numbers The algorithm for adding and subtracting is quite easy It has the best representation for 0 (all 0 bits) It is self-inverting It is easily extended to larger numbers of bits. Drawback the asymmetry seen in the range of values that can be represented by N bits. Examples: With signed-magnitude, 4 bits allow us to represent the values -7 (11112) through +7 (01112). Using two s complement, we can represent the values: -8 (1000C2) through +7 (0111C2) Overflow in complement systems (C1 and C2) An overflow occurs if two positive numbers are added and the result is negative or if two negative numbers are added and the result is positive. It is not possible to have overflow when if a positive and a negative number are being added together. To Detect Overflow Check the last two carries - If these are different: there is an overflow - If these are equal: there is no overflow Example 1: Find the sum of and 810 in binary using two s complement arithmetic. The result is C2 = -( )2 = !!! Note that the last two carries are different 17
19 Questions : Given the 8-bit binary number: What decimal number does this represent if the computer uses: a. signed-magnitude representation b. signed-1's complement c. signed-2's complement Ans. a b c Assuming 2 s complement 8-bit representation, consider the following: +70 = = Is this correct? Why or why not? Ans. No. The result is a different sign than the two numbers we are adding so overflow has occurred. Express how the number zero is represented in an 8-bit signed magnitude system, 8-bit Complement one system and 8-bit complement two system? (MID-TERM Make Up) Signed magnitude: ; Complement one: ; Complement two: MTA 1st Semester 2012/2013 Consider the decimal numbers -93. a) Represent this number in an 8-bit binary signed magnitude form. b) Represent this number in an 8-bit binary two complement s form. c) Use 8-bit two complement s arithmetic to subtract 93 from (+103). Show your calculations clearly. Show the result in two complement and decimal form. Hint: you should calculate MTA 2nd Semester 2012/2013 Consider the binary number What does this binary number represent in decimal (base 10) when it is used in: a) An 8-bit unsigned whole numbers system b) An 8-bit signed magnitude system? c) An 8-bit one s complement system? d) An 8-bit two s complement system? - Find the sum of -40 and 13 using 8-bit two s complement arithmetic (explain and show your detailed calculations clearly). Give the result in complement 2 and decimal. 18
20 (MTA 2nd Semester 2012/2013) A computer system has two different ways to represent signed numbers: Signed magnitude and two s complement. a) Show how this computer represents the number 7710 in these two different binary systems (an 8-bit signed magnitude and 8-bit two s complement) = ( )10= Since 77 is positive, 7710 = in signed magnitude and two s complement system. b) Show how this computer represents the number (-42)10 in these two different binary systems (an 8-bit signed magnitude and 8-bit two s complement) = ( )10 = In signed magnitude system: = - (101010)2 = In two s complement system: = -( )2 = ( )C2= C2 c) Show how this computer uses two s complement arithmetic to add these numbers in binary (77 + (-42)). Is there an overflow? Why or why not? There is no overflow because the last two carries are identical. 19
21 5- Floating-point representation Computers use a form of scientific notation for floatingpoint representation Numbers written in scientific notation have three components: Scientific notation in base 10: Scientific notation in base 2: In digital computers, floating-point numbers consist of three parts: A sign bit, an exponent part: representing the exponent on a power of 2, a fractional part called a significand: which is a fancy word for a mantissa. 20
22 For simplicity, in all this course, we will use a simplified 14 bits model Sign bit: 1 bit Exponent: 5 bits Significand: 8 bits Exercise 1: Represent the number 17 in a 14 bits floating point representation 17 = 17.0 x 10 0 = 1.7 x 10 1 = 0.17 x 10 2 Analogically in binary: 1710 = x 2 0 = x 2 1 = x 2 2 = x2 3 = x 2 4 = x 2 5 = x 2 6 = x 2 7 =... As a convention, we stop when the MSB of the significant is 1 : x 2 5 The exponent is 510 = The significant is: So:
23 The last floating point representation is not suitable for negative exponents Example: - the number 0.25 = = 0.12 x How to represent the negative exponent -1?! To solve such problems we use an excess-16 bias All negative and positive exponents are added by 16 We say that the real exponent is replaced by a biased exponent All exponents are converted to positive biased exponents With an excess-16 bias Exponent values less than 16 will indicate negative exponent values Exponent values more than 16 will indicate positive exponent values exponents of all zeros or all ones are typically reserved for special numbers (such as zero or infinity). 22
24 Example 1: Represent the number 17 in a 14 bits floating point form with excess-16 bias The number is positive: sign bit is = x 2 5 The exponent is 510 (5+16)10 = 2110 = The significant is: So 17 in floating point form with excess-16 bias is: Example 2: Represent the number in a 14 bits floating point form with excess-16 bias. The number is positive: sign bit is = x 2 0 = 0.12 x 2-1 The exponent is -110 (-1+16)10 = 1510 = The significant is So 0.25 in floating point form with excess-16 bias is: Example 3: Express in normalized floatingpoint form with excess-16 bias. The number is negative: sign bit is = = x2 0 = x2-1 = = 0.1x2-4 The exponent is -410 (-4+16)10 = 1210 = The significant is So in floating point form with excess-16 bias is:
25 Floating-point arithmetic To add/subtract two numbers in floating point form Both numbers should have the same exponent If exponents are different we change one of the numbers so that both of them are expressed in the same power of the base We add the binary numbers We represent the result in a normalized floating point form Example: Add the following binary numbers as represented in a normalized 14-bit format with an excess-16 bias. The second number is x2 0 The first number is x2 2 = x2 0 Now : The result is x 2 0 = x 2 2 In floating point form with excess
26 Question 1: A computer system uses a simplified 14-bit floating point with excess-16 bias to represent binary numbers. a) How does this system represent the number in binary? (MTA 2013) b) Show how this floating point system represents the decimal number in binary. (MTA) c) How does this system represent the number -33 in binary? +33? ( 2012 MOCK MTA) d) Express in the revised 14-bit floating-point model with bias = 16 (TMA ) e) Show how the number -58 is represented in binary (TMA 2013) (1 mark for the exponent, 0.5 mark for mantissa, 0.5 mark for sign bit, 0.5 mark for correct representation of the whole 14-bit binary number). Sol. a) Sign bit = 1; Exponent = = 1310 = (01101)2 ; Mantissa: Binary number in floating point format (with excess 16) is : b) 15.5 = = x 2 4 Exponent = 4 with excess 16 : 4+16 = = Mantissa: The system represents 15.5 in binary as follows: c) 33 = (100001)2 = ( )2 x 2 6 Exponent = = 2210 = (10110)2 ; Mantissa: in floating point format (with excess 16) is : in floating point format (with excess 16) is : d) or e) = -(111010)2 = x 2 6 (1.5 Marks) The sign bit is 1 : The number is negative. (1 mark) The exponent is: = 2210 = ; (2 marks) Significand: (1 Mark) The number in floating point form: (0.5 Mark) 25
27 Question 2: Consider the binary number: It is represented in a normalized 14-bit format (1 sign bit, 5 bits for exponent and 8 bits for the significand/mantissa) with an excess-16 bias. Convert this number to float (in base 10). The binary number in floating point format is: The sign bit is 1 : The number is negative. (1 mark) The exponent is: = 1510 ; After removing the exess-16 bias, the exponent becomes = -1. So the real exponent is -1. (2 marks) So the number in base two is: -( )2 x 2-1 = -(0.0101)2 (1 Mark) In decimal: -(0.0101)2 = (0x x x x2-4)10 = ( )10 = ( )10 = Question 3: Part a: Calculate the bias of the 14-bit floating-point model.[5 marks] Part b: Convert the below model to float: [5 marks] Answer: Part a: bias = 2 power 5 = 2 power 4 = 16 2 Part b: The sign bit is 1, negative number = 21 in base 10, the bias = 16, the exponent = = 5 The significant = The answer = -0.1 * 2 power 5 = 2 power 4 = -16 Question 4: is the binary representation of the unsigned decimal number 93. What is the binary representation of -93 in an 8-bit Complement one system, 8-bit Complement two system and a 14-bit floating point with an excess-16 bias system (1 sign bit, 5 bits exponent and 8 bits significand)? In a complement one system: = -( )2 = C1 (1.5 Mark) In a complement two system: = -( )2 = C1= C2 (1.5 Mark) In a floating point system: -93= -( )2 = -( )2 x 27 = -( )2 x 27 (1 Mark) Sign bit: 1; Exponent = 7+16 = 2310 = ; Mantissa: (3x1 Mark = 3Marks) So, the number in a floating point format is : (0.5 Mark) 26
28 Question 5: Assume a simple model for floating-point representation is used, the representation uses a 14-bit format, 5 bits for the exponent, with a bias of 16, a normalized significand of 8-bits, and a single sign bit for the number: I. Show how the computer would represent the numbers [20.0] and [0.375] using this floating-point format. [4 marks] II. Show how the computer would add the two floating-point numbers in part-i by changing one of the numbers so they are both expressed using the same power. III. Show how the computer would represent the sum in part-ii. [2 mark] IV. What decimal value for the sum is the computer actually storing? [1 mark]
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 informationOct: 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 informationSystems 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 informationComputer 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 informationLevent 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 informationLecture 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 informationLSN 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 informationBinary 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 informationNUMBER 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 informationNumber 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 informationCSI 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 informationEE 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 informationChapter 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 information1. 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 informationDivide: 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 informationCPEN 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 informationUseful 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 information2010/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 informationLecture 11: Number Systems
Lecture 11: Number Systems Numeric Data Fixed point Integers (12, 345, 20567 etc) Real fractions (23.45, 23., 0.145 etc.) Floating point such as 23. 45 e 12 Basically an exponent representation Any number
More informationECE 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 informationTo 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 informationNumbering 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 informationToday. 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 informationBinary 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 informationDigital 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 information2011, 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 informationBinary 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 informationThis 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 informationBinary 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 informationCS101 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 informationCHAPTER 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 informationCS321. 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 informationHOMEWORK # 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
More informationCDA 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 informationBinary 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 informationDigital Design. Assoc. Prof. Dr. Berna Örs Yalçın
Digital Design Assoc. Prof. Dr. Berna Örs Yalçın Istanbul Technical University Faculty of Electrical and Electronics Engineering Office Number: 2318 E-mail: siddika.ors@itu.edu.tr Grading 1st Midterm -
More informationChapter 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 informationSolution 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 informationNumber 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 informationplc 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 informationMEP Y9 Practice Book A
1 Base Arithmetic 1.1 Binary Numbers We normally work with numbers in base 10. In this section we consider numbers in base 2, often called binary numbers. In base 10 we use the digits 0, 1, 2, 3, 4, 5,
More informationAttention: 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 informationMATH-0910 Review Concepts (Haugen)
Unit 1 Whole Numbers and Fractions MATH-0910 Review Concepts (Haugen) Exam 1 Sections 1.5, 1.6, 1.7, 1.8, 2.1, 2.2, 2.3, 2.4, and 2.5 Dividing Whole Numbers Equivalent ways of expressing division: a b,
More informationUnsigned Conversions from Decimal or to Decimal and other Number Systems
Page 1 of 5 Unsigned Conversions from Decimal or to Decimal and other Number Systems In all digital design, analysis, troubleshooting, and repair you will be working with binary numbers (or base 2). It
More informationCOMPSCI 210. Binary Fractions. Agenda & Reading
COMPSCI 21 Binary Fractions Agenda & Reading Topics: Fractions Binary Octal Hexadecimal Binary -> Octal, Hex Octal -> Binary, Hex Decimal -> Octal, Hex Hex -> Binary, Octal Animation: BinFrac.htm Example
More informationNumeral 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 informationNumber 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
More informationData 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
More informationThis 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
More informationCOMBINATIONAL CIRCUITS
COMBINATIONAL CIRCUITS http://www.tutorialspoint.com/computer_logical_organization/combinational_circuits.htm Copyright tutorialspoint.com Combinational circuit is a circuit in which we combine the different
More informationLecture 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 informationDigital Logic Design. Introduction
Digital Logic Design Introduction A digital computer stores data in terms of digits (numbers) and proceeds in discrete steps from one state to the next. The states of a digital computer typically involve
More informationReview of Scientific Notation and Significant Figures
II-1 Scientific Notation Review of Scientific Notation and Significant Figures Frequently numbers that occur in physics and other sciences are either very large or very small. For example, the speed of
More information2 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 informationCOMP 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 informationNumber 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 informationPositional 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 informationBinary, Hexadecimal, Octal, and BCD Numbers
23CH_PHCalter_TMSETE_949118 23/2/2007 1:37 PM Page 1 Binary, Hexadecimal, Octal, and BCD Numbers OBJECTIVES When you have completed this chapter, you should be able to: Convert between binary and decimal
More informationBase 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 informationCorrectly Rounded Floating-point Binary-to-Decimal and Decimal-to-Binary Conversion Routines in Standard ML. By Prashanth Tilleti
Correctly Rounded Floating-point Binary-to-Decimal and Decimal-to-Binary Conversion Routines in Standard ML By Prashanth Tilleti Advisor Dr. Matthew Fluet Department of Computer Science B. Thomas Golisano
More information6 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 informationChapter 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 informationBinary Representation
Binary Representation The basis of all digital data is binary representation. Binary - means two 1, 0 True, False Hot, Cold On, Off We must tbe able to handle more than just values for real world problems
More informationData 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
More informationNumerical 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 informationSection 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 informationNUMBER 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 informationGoals. Unary Numbers. Decimal Numbers. 3,148 is. 1000 s 100 s 10 s 1 s. Number Bases 1/12/2009. COMP370 Intro to Computer Architecture 1
Number Bases //9 Goals Numbers Understand binary and hexadecimal numbers Be able to convert between number bases Understand binary fractions COMP37 Introduction to Computer Architecture Unary Numbers Decimal
More information3. Convert a number from one number system to another
3. Convert a number from one number system to another Conversion between number bases: Hexa (16) Decimal (10) Binary (2) Octal (8) More Interest Way we need conversion? We need decimal system for real
More information1. 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
More informationArithmetic in MIPS. Objectives. Instruction. Integer arithmetic. After completing this lab you will:
6 Objectives After completing this lab you will: know how to do integer arithmetic in MIPS know how to do floating point arithmetic in MIPS know about conversion from integer to floating point and from
More informationMACHINE INSTRUCTIONS AND PROGRAMS
CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS CHAPTER OBJECTIVES In this chapter you will learn about: Machine instructions and program execution, including branching and subroutine call and return operations
More informationExponents, Radicals, and Scientific Notation
General Exponent Rules: Exponents, Radicals, and Scientific Notation x m x n = x m+n Example 1: x 5 x = x 5+ = x 7 (x m ) n = x mn Example : (x 5 ) = x 5 = x 10 (x m y n ) p = x mp y np Example : (x) =
More informationNumber Systems. Introduction / Number Systems
Number Systems Introduction / Number Systems Data Representation Data representation can be Digital or Analog In Analog representation values are represented over a continuous range In Digital representation
More informationYOU 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 informationAPPENDIX B. Routers route based on the network number. The router that delivers the data packet to the correct destination host uses the host ID.
APPENDIX B IP Subnetting IP Addressing Routers route based on the network number. The router that delivers the data packet to the correct destination host uses the host ID. IP Classes An IP address is
More informationBachelors 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 information26 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 informationCopy 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,...}
More informationSistemas Digitais I LESI - 2º ano
Sistemas Digitais I LESI - 2º ano Lesson 6 - Combinational Design Practices Prof. João Miguel Fernandes (miguel@di.uminho.pt) Dept. Informática UNIVERSIDADE DO MINHO ESCOLA DE ENGENHARIA - PLDs (1) - The
More informationDNA Data and Program Representation. Alexandre David 1.2.05 adavid@cs.aau.dk
DNA Data and Program Representation Alexandre David 1.2.05 adavid@cs.aau.dk Introduction Very important to understand how data is represented. operations limits precision Digital logic built on 2-valued
More informationFRACTIONS COMMON MISTAKES
FRACTIONS COMMON MISTAKES 0/0/009 Fractions Changing Fractions to Decimals How to Change Fractions to Decimals To change fractions to decimals, you need to divide the numerator (top number) by the denominator
More informationBinary 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 informationComputers. 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 informationChapter 7 - Roots, Radicals, and Complex Numbers
Math 233 - Spring 2009 Chapter 7 - Roots, Radicals, and Complex Numbers 7.1 Roots and Radicals 7.1.1 Notation and Terminology In the expression x the is called the radical sign. The expression under the
More informationTHE 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 informationEverything 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 informationActivity 1: Using base ten blocks to model operations on decimals
Rational Numbers 9: Decimal Form of Rational Numbers Objectives To use base ten blocks to model operations on decimal numbers To review the algorithms for addition, subtraction, multiplication and division
More informationLogic Reference Guide
Logic eference Guide Advanced Micro evices INTOUCTION Throughout this data book and design guide we have assumed that you have a good working knowledge of logic. Unfortunately, there always comes a time
More informationZ80 Instruction Set. Z80 Assembly Language
75 Z80 Assembly Language The assembly language allows the user to write a program without concern for memory addresses or machine instruction formats. It uses symbolic addresses to identify memory locations
More informationPROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1
UNIT 22: PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1 This work covers part of outcome 2 of the Edexcel standard module. The material is
More informationCS201: Architecture and Assembly Language
CS201: Architecture and Assembly Language Lecture Three Brendan Burns CS201: Lecture Three p.1/27 Arithmetic for computers Previously we saw how we could represent unsigned numbers in binary and how binary
More informationRational Exponents. Squaring both sides of the equation yields. and to be consistent, we must have
8.6 Rational Exponents 8.6 OBJECTIVES 1. Define rational exponents 2. Simplify expressions containing rational exponents 3. Use a calculator to estimate the value of an expression containing rational exponents
More informationA Step towards an Easy Interconversion of Various Number Systems
A towards an Easy Interconversion of Various Number Systems Shahid Latif, Rahat Ullah, Hamid Jan Department of Computer Science and Information Technology Sarhad University of Science and Information Technology
More informationMeasures of Error: for exact x and approximation x Absolute error e = x x. Relative error r = (x x )/x.
ERRORS and COMPUTER ARITHMETIC Types of Error in Numerical Calculations Initial Data Errors: from experiment, modeling, computer representation; problem dependent but need to know at beginning of calculation.
More informationChapter 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 informationA single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc
Other architectures Example. Accumulator-based machines A single register, called the accumulator, stores the operand before the operation, and stores the result after the operation. Load x # into acc
More informationAN617. Fixed Point Routines FIXED POINT ARITHMETIC INTRODUCTION. Thi d t t d ith F M k 4 0 4. Design Consultant
Thi d t t d ith F M k 4 0 4 Fixed Point Routines AN617 Author: INTRODUCTION Frank J. Testa Design Consultant This application note presents an implementation of the following fixed point math routines
More informationImplementation of Modified Booth Algorithm (Radix 4) and its Comparison with Booth Algorithm (Radix-2)
Advance in Electronic and Electric Engineering. ISSN 2231-1297, Volume 3, Number 6 (2013), pp. 683-690 Research India Publications http://www.ripublication.com/aeee.htm Implementation of Modified Booth
More informationRecall 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