Number Systems - Part I CS 215 Lecture # 5.

Slides:



Advertisements
Similar presentations
ECE 331 – Digital System Design
Advertisements

Representing Numbers: Integers
DATA REPRESENTATION CONVERSION.
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Representations Example: Numbers –145 –CVL – –91 –
Chapter Chapter Goals Know the different types of numbers Describe positional notation.
Chapter 02 Binary Values and Number Systems Nell Dale & John Lewis.
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
Introduction to Number Systems
COE 202: Digital Logic Design Number Systems Part 1
BASICS OF COMPUTER APPLICATIONS ASB 102. UNIT 1 Introducing computer system  Number system  What is number system?  Types of number system  Their.
ITEC 352 Lecture 6 Back to binary. Binary Review Decoders 7 segment display Complexity of wiring Questions?
Number Systems Lecture 02.
Data Representation in Computers. Data Representation in Computers/Session 3 / 2 of 33 Number systems  The additive approach – Number earlier consisted.
Dr. Bernard Chen Ph.D. University of Central Arkansas
Binary and Hexadecimal Numbers
Number Systems.
Numbering systems.
Number Systems - Part II
CS105 INTRODUCTION TO COMPUTER CONCEPTS BINARY VALUES & NUMBER SYSTEMS Instructor: Cuong (Charlie) Pham.
Numeral Systems Subjects: Numeral System Positional systems Decimal
IT-101 Section 001 Lecture #3 Introduction to Information Technology.
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
Data Representation - Part I. Representing Numbers Choosing an appropriate representation is a critical decision a computer designer has to make The chosen.
Representing Data. Representing data u The basic unit of memory is the bit  A transistor that can hold either high or low voltage  Conceptually, a tiny.
1 Digital Design: Number Systems Credits : Slides adapted from: J.F. Wakerly, Digital Design, 4/e, Prentice Hall, 2006 C.H. Roth, Fundamentals of Logic.
NUMBER SYSTEM.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
1-1 Lecture 1 Class Overview and Appendix A -- Number Systems.
Chapter 2 Binary Values and Number Systems. 2 2 Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645,
Integer Representation for People Computer Organization and Assembly Language: Module 3.
CMPE12c Fall 03Cyrus BazeghiCMPE12c Fall 03Cyrus Bazeghi 1 Number Systems.
Number systems, Operations, and Codes
Numbering System Base Conversion. Number systems Decimal – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Binary – 0, 1 Octal – 0, 1, 2, 3, 4, 5, 6, 7 Hexadecimal system.
Chapter1: Number Systems
Positional Notation 642 in base 10 positional notation is:
Lecture 2 Binary Values and Number Systems. The number 943 is an example of a number written in positional notation. The relative positions of the digits.
AEEE2031 Data Representation and Numbering Systems.
Number Systems. Prehistory Unary, or marks: / /////// = 7 /////// + ////// = ///////////// Grouping lead to Roman Numerals: VII + V = VVII = XII Better,
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
ELEN 033 Lecture #5 Tokunbo Ogunfunmi Santa Clara University.
NUMBER SYSTEM. Number System Number Base B => B symbols – Base 16(Hexa):0, 1,……9, A,…, E, F – Base 10 (Decimal): 0, 1, 2,……, 7, 8, 9 – Base 8(Octal):
Chapter 2 Binary Values and Number Systems Chapter Goals Distinguish among categories of numbers Describe positional notation Convert numbers in.
CSC 331: DIGITAL LOGIC DESIGN COURSE LECTURER: E. Y. BAAGYERE. CONTACT: LECTURE TIME: 15:40 – 17:45 hrs. VENUE: SP-LAB.
ECE DIGITAL LOGIC LECTURE 2: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/14/2016.
Number Systems. ASCII – American Standard Code for Information Interchange – Standard encoding scheme used to represent characters in binary format on.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
Digital logic COMP214  Lecture 2 Dr. Sarah M.Eljack Chapter 1 1.
Binary Values. Numbers Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative Numbers.
Introduction To Number Systems
Digital Logic & Design Adil Waheed Lecture 02.
Digital Logic & Design Dr. Waseem Ikram Lecture 02.
Number system Numbers 1) natural number:
COMPUTING FUNDAMENTALS
ITE102 – Computer Programming (C++)
Chapter 3 Data Representation
Number System conversions
Chapter 1 Number Systems & Conversions
Number Systems and Binary Arithmetic
MMNSS COLLEGE,KOTTIYAM DEPARTMENT OF PHYSICS
Numbering System TODAY AND TOMORROW 11th Edition
Digital Logic & Design Lecture 02.
Digital Logic Design (ECEg3141) 2. Number systems, operations & codes 1.
Digital Logic Design (CSNB163)
Data Representation and Organization
Numeral systems (radix)
Binary to Decimal Conversion
Chapter 2 Number System.
Presentation transcript:

Number Systems - Part I CS 215 Lecture # 5

Motivation The representation of numbers is made difficult because of the discrete nature of computer representation Not all numbers can be represented in a computer The chosen method of representation affects the ease by which arithmetic operations are performed

Unary Representation In a unary representation, the number one is represented by a single mark, the number two by two marks, etc. Unary has limitations: the number of symbols necessary to represent a number grows directly with the value negative numbers can not be represented

Roman Numerals Roman numerals are sorted by decreasing values A symbol representing a smaller value preceding a symbol representing a larger value means we have to subtract the smaller value from the larger value Only a single smaller symbol may precede a larger one Only symbols representing powers of ten (I,X,C) may be placed out of order I 1 V 5 X 10 L 50 C 100 D 500 M 1000

Addition in Roman Numerals? A possible algorithm Convert all position sensitive symbols into position insensitive form Sort by values of symbols Merge the two position-insensitive representations into a single position-insensitive representation Combine lowest-value types into higher value-types Create legal Roman numerals by converting back to the unique format

Example 5.1 XIX (19) + MXMV (1995) XIX = XVIIII MXMV = MDCCCCLXXXXV XVIIII + MDCCCCLXXXXV = MDCCCCLXXXXXVVIIII MDCCCCLXXXXXVVIIII = MDCCCCLXXXXXXIIII = MDCCCCLLXIIII = MDCCCCCXIIII = MDCCCCCXIIII = MDDXIIII = MMXIIII MMXIIII = MMXIV (2014)

Weighted Positional Notation Use the position of the symbol to indicate the value By assigning each position the appropriate power of the base, we can get a unique representation of numbers in that base Decimal System (Base 10) Given a sequence of n digits d0,d1,…,dn-1 dn-1.10n-1 + … + d1.101 + d0.100

In general, given a sequence of n digits s0,s1,…,sn-1 and a base b, sn-1.bn-1 + … + s1.b1 + s0.b0 yields a unique integer N s0 is the least significant digit sn-1 is the most significant digit The most significant symbol can not be zero

Any positive integer value can be used as the base or radix for a weighted positional notation For bases less than or equal to 10, a subset of the ten decimal digits can be used, e.g., binary (base 2) and octal (base 8) For bases more than 10, new symbols will have to be introduced, e.g., hexadecimal (base16)

We use a subscript to indicate the base of the number when we are writing. In programming languages, octal representation may be preceded with a zero (0), e.g., 033. A hexadecimal representation may be preceded with 0x, e.g., 0x1b SAL and MAL use these for hexadecimal and decimal numbers; octal is not recognized

Representations in different radices binary octal hexa decimal 000 0 0 0 001 1 1 1 010 2 2 2 011 3 3 3 100 4 4 4 1111 17 F 15

Hexadecimal and Octal Hex Octal Decimal Binary 1 1 1 0001 2 2 2 0010 1 1 1 0001 2 2 2 0010 3 3 3 0011 4 4 4 0100 5 5 5 0101 6 6 6 0110 7 7 7 0111 8 10 8 1000 9 11 9 1001 A 12 10 1010 B 13 11 1011 C 14 12 1100 D 15 13 1101 E 16 14 1110 F 17 15 1111

Discriminating only between two symbols would be far cheaper in digital circuitry than three, four, etc. thus binary is the chosen representation for computers. Since bits can be grouped into three to obtain octal value and into four to obtain hexadecimal value, it is much easier for humans to work with octal and hexadecimal representations.

hexadecimal, octal, and binary To convert the octal or hexadecimal representation from binary simply group them starting from the least significant bit into three for octal and into four for hexadecimal Example octal hexa binary 11011 011 011 0001 1011 3 3 1 B hence: 11011 is 338 or 1B16 or 0x1B or 033

Example 5.2 Convert 11101 to octal _________ Convert 11101 to hexadecimal _________ Convert 100110 to octal _________ Convert 11001100 to hexadecimal _________

Zero and negative numbers To represent zero, we violate the rule that says the most significant symbol can not be zero, and use the single symbol ‘0’ We can specify, a symbol ‘-’ that is placed only at the beginning of the sequence to signify negative numbers The absence of or presence of the symbol ‘+’ signify positive numbers

Conversion into Decimal Given a sequence of base-r digits sn-1...s1s0 convert the sequence into a decimal number N using: N = sn-1.bn-1 + … + s1.b1 + s0.b0

Example 5.3 Convert 10 01102 to decimal. = 3810 Convert 3b216 to decimal. N = 3*162 + 1110*161 + 2*160 = 94610 Convert 3708 to decimal. N = 3*82 + 7*81 + 0*80 = 192 + 56 + 0 = 24810

Example 5.4 Convert the following to decimal: 1. 3467 _______ 1. 3467 _______ 2. 123 _______ 4. 1448 _______ 5. 6A16 _______ 6. 1002 _______