1 Number Systems Patt and Patel Ch. 2+. 2 A Brief History of Numbers From Gonick, Cartoon Guide to Computer Science.

Slides:



Advertisements
Similar presentations
DATA REPRESENTATION CONVERSION.
Advertisements

Chapter 2 : Number System
MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 1 Lecture 3 Number System.
Level ISA3: Information Representation
CMPE12cGabriel Hugh Elkaim 1 Number Systems. CMPE12cGabriel Hugh Elkaim 2 A Brief History of Numbers From Gonick, Cartoon Guide to Computer Science.
Chapter Chapter Goals Know the different types of numbers Describe positional notation.
Converting Binary to Octal
Number Systems and Arithmetic
Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.
Dr. Bernard Chen Ph.D. University of Central Arkansas
Number Systems.
(2.1) Fundamentals  Terms for magnitudes – logarithms and logarithmic graphs  Digital representations – Binary numbers – Text – Analog information 
ES 244: Digital Logic Design Chapter 1 Chapter 1: Introduction Uchechukwu Ofoegbu Temple University.
CS105 INTRODUCTION TO COMPUTER CONCEPTS BINARY VALUES & NUMBER SYSTEMS Instructor: Cuong (Charlie) Pham.
Numeral Systems Subjects: Numeral System Positional systems Decimal
Data Representation – Binary Numbers
EKT 121 / 4 ELEKTRONIK DIGIT 1 CHAPTER 1 : INTRODUCTION.
Numbering Systems CS208.
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
The number systems of Computer Science
Chapter 3 Data Representation
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
Lecture 4 Last Lecture –Positional Numbering Systems –Converting Between Bases Today’s Topics –Signed Integer Representation Signed magnitude One’s complement.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 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,
CMPE12c Fall 03Cyrus BazeghiCMPE12c Fall 03Cyrus Bazeghi 1 Number Systems.
CCE-EDUSAT SESSION FOR COMPUTER FUNDAMENTALS Date: Session III Topic: Number Systems Faculty: Anita Kanavalli Department of CSE M S Ramaiah.
Number systems, Operations, and Codes
Chapter1: Number Systems
CISC1100: Binary Numbers Fall 2014, Dr. Zhang 1. Numeral System 2  A way for expressing numbers, using symbols in a consistent manner.  " 11 " can be.
Data Representation, Number Systems and Base Conversions
Positional Number Systems Decimal, Binary, Octal and Hexadecimal Numbers Wakerly Section
Binary01.ppt Decimal Decimal: Base 10 means 10 Unique numerical digits ,00010,000 Weight Positions 3,
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)
Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x, /.
School of Computer and Communication Engineering, UniMAP Mohd ridzuan mohd nor DKT 122/3 - DIGITAL SYSTEM I Chapter.
Introduction To Number Systems Binary System M. AL-Towaileb1.
Number Representation Lecture Topics How are numeric data items actually stored in computer memory? How much space (memory locations) is.
Chapter 1 Number Systems Digital Electronics. Topics discussed in last lecture Digital systems Advantages of using digital signals over analog. Disadvantages.
CHAPTER 3: Number Systems
Number Systems – Definitions page 214 The radix or base 밑 refers to the number b in an expression of the form b n. The number n is called the exponent.
CS151 Introduction to Digital Design Chapter 1: Digital Systems and Information Lecture 2 1Created by: Ms.Amany AlSaleh.
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.
ECE 2110: Introduction to Digital Systems Number Systems: conversions.
Numeral Systems Rubel Biswas.
Dr. Nermin Hamza 1. Materials Book: Digital Design 4 th M. Morris Mano and Michael D. Ciletti 2.
Prepared By: Norakmar Binti Mohd Nadzari CHAPTER 2 ARITHMETIC AND LOGIC UNIT.
Number Systems & Binary Arithmetic
Introduction To Number Systems
Positional Number Systems Decimal, Binary, Octal and Hexadecimal Numbers Wakerly Section
Digital Design Chapter One Digital Systems and Binary Numbers
Number Systems and Binary Arithmetic
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
CHAPTER 1 : INTRODUCTION
Number Systems.
COMPUTING FUNDAMENTALS
ITE102 – Computer Programming (C++)
Chapter 3 Data Representation
Number System conversions
Number Systems and Binary Arithmetic
1. Number Systems.
Numbering System TODAY AND TOMORROW 11th Edition
Chapter 2: Number Systems
Digital Logic Design (CSNB163)
Chapter Four Data Representation in Computers By Bezawit E.
1. Number Systems Chapt. 2.
Presentation transcript:

1 Number Systems Patt and Patel Ch. 2+

2 A Brief History of Numbers From Gonick, Cartoon Guide to Computer Science

3

4

5 Prehistoric Ledgers

6

7 Elaborate Finger Counting

8

9

10

11 Ancient Number Systems

12

13 Positional Number Systems

14

15

16

17

18

19 Number Systems PrehistoryPrehistory –Unary, or marks: /////// = 7 /////// + ////// = ///////////// Grouping lead to Roman Numerals:Grouping lead to Roman Numerals: –VII + V = VVII = XII Better, Arabic Numerals:Better, Arabic Numerals: –7 + 5 = 12 = 1 x

20 Positional Number System Base 10 is a special case of positional number systemBase 10 is a special case of positional number system PNS first used over 4000 years ago in Mesopotamia (Modern day Iraq)PNS first used over 4000 years ago in Mesopotamia (Modern day Iraq) –Base 60 (Sexagesimal) –Digits: (written as 60 different symbols) –5,45 60 = 5 x x 1 = Positional number systems are great for arithmeticPositional number systems are great for arithmetic Why?Why?

is really345 is really –3 x x x 10 0 –3 x x x 1 –3 is the most significant symbol (carries the most weight) –5 is the least significant symbol (carries the least weight) Digits (or symbols) allowed: 0-9Digits (or symbols) allowed: 0-9 Base (or radix): 10Base (or radix): 10 Arabic Numerals

22 Try multiplication in (non-positional) Roman numerals! XXXIII (33 in decimal) XII (12 in decimal) XXXIII CCCXXX CCCXXXXXXXXXIIIIII CCCLXXXXVI CCCXCVI = 396 in decimal Positional Number System The Mesopotamians wouldn’t have had this problem!! * +

23 Positional Number System There are many ways to “represent” a numberThere are many ways to “represent” a number Representation does not affect computation resultRepresentation does not affect computation result LIX + XXXIII= LXXXXII(Roman Numerals)LIX + XXXIII= LXXXXII(Roman Numerals) = 92 (Decimal) = 92 (Decimal) Representation affects difficulty of computing resultsRepresentation affects difficulty of computing results Computers need a representation that works with fast electronic circuitsComputers need a representation that works with fast electronic circuits Positional numbers work great with 2-state devicesPositional numbers work great with 2-state devices

24

25

26 What ’10’ Means

27 Number Base Systems

28 Binary Numbers

29

30 The Powers of 2

31

32 Equivalent Numbers

33 Converting Binary to Decimal

34 Binary Number System Base (radix): 2Base (radix): 2 Digits (symbols) allowed: 0, 1Digits (symbols) allowed: 0, 1 Binary Digits, or bitsBinary Digits, or bits is really is really 1 x x X X is really is really 1 x x x x x

35 Computers multiply Arabic numerals by converting to binary, multiplying and converting back (much as us with Roman numerals) Binary Number System So if the computer is all binary how does it multiply 5 by 324 when I type it in the calculator program?

36 Octal Number System Base (radix): 8Base (radix): 8 Digits (symbols): 0 – 7Digits (symbols): 0 – is really345 8 is really –3 x x x 8 0 – – is really is really –1 x x x x 8 0 – – In C, octal numbers are represented with a leading 0 (0345 or 01001).In C, octal numbers are represented with a leading 0 (0345 or 01001).

37 Base (radix): 16Base (radix): 16 Digits (symbols) allowed: 0 – 9, a – fDigits (symbols) allowed: 0 – 9, a – f HexDecimal a10 b11 c12 d13 e14 f15 Hexadecimal Number System

38 A3 16 is really: A x x E8 16 is really: 3 x E x x x x x Hexadecimal Number System Some Examples of converting hex numbers to decimal

39 10C 16 is really: 1 x x C x x x In C, hex numbers are represented with a leading “0x” (for example “0xa3” or “0x10c”). Hexadecimal Number System

40 For any positional number system Base (radix): b Digits (symbols): 0 … (b – 1) S n-1 S n-2 ….S 2 S 1 S 0 Use summation to transform any base to decimal Positional Number System Value = Σ (S i b i ) n-1 i=0

41 More PNS fun = = =403 5 = =27 17 = =356 9 = = = 2A6 12 =2A6 12 = BEEF 16 =BEEF 16 = =69 10 = =41 10 = =14 10 = =

42 Decimal -> Binary Conversion Divide decimal value by 2 until the value is 0Divide decimal value by 2 until the value is 0 Know your powers of two and subtractKnow your powers of two and subtract –… Example: 42Example: 42 –What is the biggest power of two that fits? –What is the remainder? –What fits? –What is the remainder? –What fits? –What is the binary representation?

43 Decimal  Binary Conversion

44 Decimal  Binary Conversion = = = = =26 10 =

45 Base Conversion Binary -> Octal Conversion Group into 3’s starting at least significant symbolGroup into 3’s starting at least significant symbol –Add leading 0’s if needed (why not trailing?) Write 1 octal digit for each groupWrite 1 octal digit for each group Examples:Examples: – (binary) –4 2 7 (octal) – (binary) –2 5 6 (octal)

46 Octal -> Binary Conversion It is simple, just write down the 3-bit binary code for each octal digit OctalBinary Base Conversion

47 Base Conversion Binary -> Hex Conversion Group into 4’s starting at least significant symbolGroup into 4’s starting at least significant symbol –Adding leading 0’s if needed Write 1 hex digit for each groupWrite 1 hex digit for each group Examples:Examples: – –9 e 7 0 – –1 f a 3

48 Hex -> Binary Conversion Again, simply write down the 4 bit binary code for each hex digit Example: 3 9 c Base Conversion

49 Conversion Table DecimalHexadecimalOctalBinary A B C D E F Base Conversion

50

51 Hex -> Octal Do it in 2 steps, hex -> binary -> octal Decimal -> Hex Do it in 2 steps, decimal -> binary -> hex So why use hex and octal and not just binary and decimal? Base Conversion

52 More Conversion Practice

53

54

55 Most humans precede number with “-” (e.g., -2000)Most humans precede number with “-” (e.g., -2000) Accountants, however, use parentheses: (2000) or color 2000 Sign-magnitude formatSign-magnitude format Example: in hex?Example: in hex? = 3 x e x x 16 0 = -3E8 16 Negative Integers

56 Mesopotamians used positional fractions Sqrt(2) = 1.24,51,10 60 = 1 x x x x = Most accurate approximation until the Renaissance Positional Fractions

57 f n-1 f n-2 … f 2 f 1 f 0 f -1 f -2 f -3 … f m-1 Decimal (radix) point Generalized Representation For a number “f” with “n” digits to the left and “m” to the right of the decimal place Position is the power Positional Fractions

58 Fractional Representation What is 3E.8F 16 ?What is 3E.8F 16 ? How about ?How about ? = 3 x E x x F x = / /256 = 1 x x x x x 2 -3 = /2 + 1/8

59 More PNS Fractional Fun = = = = = = A.3A 12 =A.3A 12 =

60 Converting Decimal -> Binary fractions Consider left and right of the decimal point separately.Consider left and right of the decimal point separately. The stuff to the left can be converted to binary as before.The stuff to the left can be converted to binary as before. Use the following table/algorithm to convert the fractionUse the following table/algorithm to convert the fraction

61 Fraction Fraction x 2 Digit left of decimal point  most significant (f -1 ) (it must repeat from here!!) Different bases have different repeating fractions = … 2 = Numbers can repeat in one base and not in another. For to binary

62 What is in: Binary Hex

63 Generic Fractional Base Separate the whole part to the fractional partSeparate the whole part to the fractional part –Know how to solve the whole part For the fractional part, use the same algorithm of successive multiplication and take off the whole partFor the fractional part, use the same algorithm of successive multiplication and take off the whole part –Sounds harder than it is

64 Let’s do an example = ?? = ?? 3

65 Let’s do another one = ?? = ?? 4

66 And yet another one = ?? = ?? 5

67

68 Fixed Point Numbers Used in digital filtering schemes for small microsUsed in digital filtering schemes for small micros Control applications need floating point numbers, but they can be very slow on small microsControl applications need floating point numbers, but they can be very slow on small micros Fourier transforms for tone detection implemented on small microsFourier transforms for tone detection implemented on small micros

69 Digital Filtering

70 Low-Pass Filter Butterworth digital low pass filterButterworth digital low pass filter Attenuated signal frequencies above 1/8 sample rate.Attenuated signal frequencies above 1/8 sample rate z z z z

71 Difference Equation

72 Bode Plot

73 How do you implement this?

74 Questions?

75