Lecture 2: 8/29/2002CS149D Fall 20021 CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.

Slides:



Advertisements
Similar presentations
Intro to CS – Honors I Representing Numbers GEORGIOS PORTOKALIDIS
Advertisements

DATA REPRESENTATION CONVERSION.
Lecturer: Omid Jafarinezhad Sharif University of Technology Department of Computer Engineering 1 Fundamental of Programming (C) Lecture 2 Number Systems.
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Kavita Hatwal Fall The decimal system, also called the base 10 number system is based on ten numbers: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. All the numbers.
Agenda Shortcuts converting among numbering systems –Binary to Hex / Hex to Binary –Binary to Octal / Octal to Binary Signed and unsigned binary numbers.
Number Representation (1) Fall 2005 Lecture 12: Number Representation Integers and Computer Arithmetic.
Chapter Chapter Goals Know the different types of numbers Describe positional notation.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
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.
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
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.
Binary and Hexadecimal Numbers
Simple Data Type Representation and conversion of numbers
ES 244: Digital Logic Design Chapter 1 Chapter 1: Introduction Uchechukwu Ofoegbu Temple University.
Lecture 5.
CS105 INTRODUCTION TO COMPUTER CONCEPTS BINARY VALUES & NUMBER SYSTEMS Instructor: Cuong (Charlie) Pham.
Number Systems Binary and Hexadecimal. Base 2 a.k.a. Binary  Binary works off of base of 2 instead of a base 10 like what we are taught in school 
Numeral Systems Subjects: Numeral System Positional systems Decimal
Data Representation – Binary Numbers
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 1 Today’s Topics How information.
Numbering Systems. CSCE 1062 Outline What is a Numbering System Review of decimal numbering system Binary representation range Hexadecimal numbering system.
Computer System & Binary Review. Memory Model What memory is supposed to look like.
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
Chapter 1 Data Storage(3) Yonsei University 1 st Semester, 2015 Sanghyun Park.
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 20, 2004 Lecture Number: 23.
Calculating Two’s Complement. The two's complement of a binary number is defined as the value obtained by subtracting the number from a large power of.
Number Systems. Today Decimal Hexadecimal Binary –Unsigned Binary –1’s Complement Binary –2’s Complement Binary.
46 Number Systems Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs Display: Seven segment displays Inputs: Switches.
Representation of Data Ma King Man. Reference Text Book: Volume 2 Notes: Chapter 19.
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,
Computer Arithmetic and the Arithmetic Unit Lesson 2 - Ioan Despi.
6 October 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Binary Values and Number Systems Chapter Goals Distinguish among categories of numbers Describe positional notation Convert numbers in other bases.
Dr. Ahmed Telba EE208: Logic Design Lecture# 1 Introduction & 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.
1 Representation of Data within the Computer Oct., 1999(Revised 2001 Oct)
Chapter 2 Number Systems: Decimal, Binary, and Hex.
EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.
Lecture 1: 8/27/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Binary01.ppt Decimal Decimal: Base 10 means 10 Unique numerical digits ,00010,000 Weight Positions 3,
 Lecture 2 Processor Organization  Control needs to have the  Ability to fetch instructions from memory  Logic and means to control instruction sequencing.
COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.6 Instructor: Lin Chen Sept 2013.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
IT1004: Data Representation and Organization Negative number representation.
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
In decimal we are quite familiar with placing a “-” sign in front of a number to denote that it is negative The same is true for binary numbers a computer.
Number Systems. Topics  The Decimal Number System  The Binary Number System  Converting from Binary to Decimal  Converting from Decimal to Binary.
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.
Binary Values. Numbers Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative Numbers.
Some basic concepts underlying computer archi­tecture
Chapter 02 Nell Dale & John Lewis.
Discrete Mathematics Numbering System.
Integer Real Numbers Character Boolean Memory Address CPU Data Types
CSE 102 Introduction to Computer Engineering
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
University of Gujrat Department of Computer Science
Introduction to IT By: Muhammed s. anwar.
Data Representation in Computer Systems
Number Systems Rayat Shikshan Sanstha’s
Number Systems Rayat Shikshan Sanstha’s
COMS 161 Introduction to Computing
Presentation transcript:

Lecture 2: 8/29/2002CS149D Fall CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture 2: 8/29/2002

CS149D Fall Outline Number Systems Decimal/Binary Octal/Hexadecimal Binary addition Representing Negatives Two’s complement notation and addition Overflow problem Today’s lecture covers sections 1.4, 1.5, and 1.6 in Brookshear text

Lecture 2: 8/29/2002CS149D Fall All computers use the binary number system (base 2) basic nature of electronic circuits ON/OFFTRUE/FALSE current flow/does not flow Machine alphabet has two letters “0”, “1” Each letter is a binary digit “bit”. Byte is 8 bits. Introduction

Lecture 2: 8/29/2002CS149D Fall Numbers can be represented in any base (humans use base 10) Symbols for a number system of base B are 0, 1, 2, …, B –1 decimal (base 10) 0, 1, 2,.., 9binary (base 2) 0, 1 notation “number B ” (375 in decimal is written , 1011 in binary is written ) Value of i th digit d is “d * B i” where i starts from 0 and increases from right to left 2 1 0ipositional notation 3 7 5d 5 * 10 0 =5 7 * 10 1 =70 3 * 10 2 =300 Three hundred and seventy five Number Systems

Lecture 2: 8/29/2002CS149D Fall Conversion from binary to decimal Convert to decimal = (1 * 2 0 ) + (1 * 2 1 ) + (0 * 2 2 ) + (1 *2 3 ) = = i d This process can be used for conversion from any number system to decimal (TRY convert to decimal)

Lecture 2: 8/29/2002CS149D Fall Conversion from decimal to binary Convert to binary Step 1: divide value by 2 and record remainder Step 2: as long as quotient not zero, continue to divide the newest quotient by 2 and record the remainder Step 3: when obtain a zero as quotient, binary representation consists of remainders listed from right to left in order OperationQuotientremainder 13 by by by by =

Lecture 2: 8/29/2002CS149D Fall Other Number Systems Octal (base 8) Symbols (0, 1, 2, 3, 4, 5, 6, 7) Working with too long binary numbers is a problem Hexadecimal (base 16) Symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F) Byte = 8 bits = 2 hex digits ( 1 hex digit is 4 bits) B5 16 = ? 2 B 16 is is B5 16 =

Lecture 2: 8/29/2002CS149D Fall Conversion from binary to hex Convert to hex Divide binary number into 4 bits groups from right to left E 16 34E

Lecture 2: 8/29/2002CS149D Fall DecimalBinaryHexadecimal A B C D E F 2 0 = 12 7 = = 22 8 = = 42 9 = = = = = = = = = 8190

Lecture 2: 8/29/2002CS149D Fall Binary Addition Binary addition table = = = = 0 and a carry of

Lecture 2: 8/29/2002CS149D Fall Negative numbers 1/4 Sign and magnitude Left hand bit is used to determine the sign of the number Left hand bit 0 = positive number Left hand bit 1 = negative number 0010 = = -2 Using 4 bits with sign and magnitude, largest positive number represented is 7 (-7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7) 15 values overall can be represented

Lecture 2: 8/29/2002CS149D Fall Negative numbers 2/4 Two’s Complement +2 added to –2 in sign magnitude using regular binary addition does not equal 0 (make sure of that!) First bit indicates a negative value but also bears a position value For a positive number, the two’s complement representation is itself For a negative number, complement positive value, then add 1 3 in two’s complement is in two’s complement is Invert bits011 becomes 100 Add = 101 Invert bits 0 becomes 1 1 Becomes 0

Lecture 2: 8/29/2002CS149D Fall What is 1010 in two’s complement? It is a negative number since left hand bit is a 1 Invert bits1010 becomes 0101 Add = 0110 (+6) Then the original number is -6 Negative numbers 3/4

Lecture 2: 8/29/2002CS149D Fall Negative Numbers 4/4 Two’s complement addition Copyright 2003 Pearson Education, Inc. Subtraction performed the same as addition 7-5 is the same as 7+ (-5) 1011 = -(0100+1) = -(0101) = -5

Lecture 2: 8/29/2002CS149D Fall Overflow Problem Try adding in 4-bit two’s complement notation Overflow. Result is Negative value Actually –(0110+1) = -(0111) = -7 There is a limit to the size of the values that can be represented according to how many bits are used. Normally integers are represented in 32-bit patterns.