COMS 161 Introduction to Computing

Slides:



Advertisements
Similar presentations
DATA REPRESENTATION CONVERSION.
Advertisements

HEXADECIMAL NUMBERS Code
CIS 020 Assembly Programming Chapter 02 - Numbering Systems & Data Representation © John Urrutia 2012, All Rights Reserved.5/27/20121.
Digital Fundamentals Floyd Chapter 2 Tenth Edition
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Number Systems Decimal (Base 10) Binary (Base 2) Hexadecimal (Base 16)
Data Representation in Computers
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
Binary Numbers.
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
Data Representation in Computers. Data Representation in Computers/Session 3 / 2 of 33 Number systems  The additive approach – Number earlier consisted.
Simple Data Type Representation and conversion of numbers
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4.
Data Representation – Binary Numbers
EKT 121 / 4 ELEKTRONIK DIGIT 1 CHAPTER 1 : INTRODUCTION.
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
Chapter 3 Data Representation
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 29, 2004 Lecture Number: 26.
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 20, 2004 Lecture Number: 23.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
Number systems, Operations, and Codes
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 6, 2004 Lecture Number: 6.
AEEE2031 Data Representation and Numbering Systems.
Binary01.ppt Decimal Decimal: Base 10 means 10 Unique numerical digits ,00010,000 Weight Positions 3,
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
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.
1 COMS 161 Introduction to Computing Title: Computing Basics Date: September 8, 2004 Lecture Number: 7.
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.
Dr. ClincyLecture 2 Slide 1 CS Chapter 2 (1 of 5) Dr. Clincy Professor of CS Note: Do not study chapter 2’s appendix (the topics will be covered.
Prepared By: Norakmar Binti Mohd Nadzari CHAPTER 2 ARITHMETIC AND LOGIC UNIT.
Lecture 4: Digital Systems & Binary Numbers (4)
Number Systems & Binary Arithmetic
Some basic concepts underlying computer archi­tecture
Cosc 2150: Computer Organization
Chapter 2 Binary Number Systems.
Introduction To Number Systems
EI205 Lecture 2 Dianguang Ma Fall, 2008.
Digital Logic and Computer Organization
Number Systems and Binary Arithmetic
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
CHAPTER 1 : INTRODUCTION
CS1001 Programming Fundamentals 3(3-0) Lecture 2
CSE 102 Introduction to Computer Engineering
Chapter 3 Data Representation
Number System conversions
Number Systems.
University of Gujrat Department of Computer Science
BEE1244 Digital System and Electronics BEE1244 Digital System and Electronic Chapter 2 Number Systems.
Data Representation in Computer Systems
Numbering System TODAY AND TOMORROW 11th Edition
Digital Logic Design (ECEg3141) 2. Number systems, operations & codes 1.
COMS 161 Introduction to Computing
COMS 161 Introduction to Computing
CS 101 – Sept. 4 Number representation Integer Unsigned √ Signed √
COMS 161 Introduction to Computing
COMS 161 Introduction to Computing
Number Systems Rayat Shikshan Sanstha’s
COMS 161 Introduction to Computing
Introduction To Number Systems
Presentation transcript:

COMS 161 Introduction to Computing Title: Digital Numbers Date: February 2, 2005 Lecture Number: 10

Announcements Homework 3 Due 2/04/05 Paper 1 proposal

Review Numbers Items verses bits Numeric ranges Binary to Decimal Conversion Decimal to Binary Conversion Repeated division

Outline Numbers Decimal to Binary Conversion Adding binary numbers Subtraction Method Adding binary numbers Signed numbers Hexadecimal Binary Coded Decimal (BCD)

Decimal to Binary Conversion Algorithm: Subtraction Method Start with a positional number that is greater than the decimal number If (the positional number is less than the decimal number) Subtract the positional number from the decimal number Write down a 1 Else Write down a 0 Continue until the remainder is 0

Decimal to Binary Conversion Positional value Subtraction Remainder Binary 27 = 12810 10510 - 0 10510 02 26 = 6410 10510 - 6410 4110 012 25 = 3210 4110 - 3210 910 0112 24 = 1610 910 - 010 01102 23 = 810 910 - 810 110 011012 22 = 410 110 - 010 0110102 21 = 210 01101002 20 = 110 110 - 110 010 011010012

Adding Binary Numbers Binary addition is just like decimal addition Can only use the 2 (1 and 0) symbols of the binary alphabet Carry ahead if needed

Adding Binary Numbers Rules of addition 0 + 0 = 1 0 + 1 = 1 1 + 0 = 1 1 + 1 = 10 1 + 1 + 1 = 11 1 1 1 17 11 + 7 + 1 2 4 1

Binary Number System How about representing negative numbers? Let the left most bit represent the sign (+, -) of the number Called signed magnitude representation [s][mag]

Signed Magnitude One less bit to represent the magnitude

Signed Magnitude Problems Two values of 0 Incorrect arithmetic More difficult to detect than one value of 0 Incorrect arithmetic 2 – 1 = 2 + (-1) = 1

Two’s Complement Representation Sign bit in a sense Positive numbers The leading bit (left most) is zero The same as signed magnitude Negative numbers The leading bit is one Defined so that when added to their corresponding positive number the answer is zero

Two’s Complement Representation Bit Pattern Value 0000 1000 -8 0001 1 1001 -7 0010 2 1010 -6 0011 3 1011 -5 0100 4 1100 -4 0101 5 1101 -3 0110 6 1110 -2 0111 7 1111 -1

Two’s Complement Representation Problems with signed magnitude representation are solved with the two’s complement representation There is only value of zero Arithmetic is correct Solution is in two’s complement form 2 – 1 = 2 + (-1) = 1

Binary number system Letters in the English language … Z = 9010 = 0101 10102 a = 9710 = 0110 00012 Z = 12210 = 0111 10102 Numbers are still left over for punctuation

Binary number system Precision The number of bits used to represent an item Letter: precision of 8 bits Integer (whole number): precision of 32 or 64 bits Always finite Computers have finite precision Presents some limitations

Hexadecimal number system Sometimes called hex Positional,base-16 system Each digit is multiplied by a power of 16 Sixteen unique symbols (digits) 0, 1, 2, …, 15 Symbol a or A for 10 Symbol b or B for 11 Symbol e or E for 14 Symbol c or C for 12 Symbol f or F for 15 Symbol d or D for 13

Hexadecimal number system A hex number can represent 16 different items Equivalent to 4 bits Makes it easy to convert between binary and hex Group bits by 4’s from the left end Substitute the hex symbol 9010 = 0101 10102 = 5A16 Is the base 16 really needed? 6610 = 0100 00102 = 4216

Hexadecimal number system Use the backwards conversion to convert hex to binary One hex digit is equivalent to 4 bits Substitute the binary nibble Always start at the right end Add zeros to the left end as necessary to fill in 4 bits

Hexadecimal number system BIN 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 A 10 1010 B 11 1011 C 12 1100 D 13 1101 E 14 1110 F 15 1111

Digitization The process of converting analog information into binary Discrete forms are unambiguous Text and numbers are discrete Conversion of discrete to digital Come up with a mapping As we did with the letters

Binary Coded Decimal Integers (whole numbers) One mapping is to use its binary equivalent Binary Coded Decimal (BCD) 010 = 00002 110 = 00012 … 910 = 10012 Need a minimum of 4 bits to represent 10 different values Some 4 bit quantities are wasted

Binary Coded Decimal String of decimal digits Each decimal digit is represented by 4 bits The number of bits needed to represent different numbers vary Performing arithmetic is complicated