Number Representation 1 Lecture 2. Outcomes By the end of the session you should: – Understand what bits/bytes/words are. – Understanding conversion between.

Slides:



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

Representing Numbers: Integers
Computer Engineering (Logic Circuits) Dr. Tamer Samy Gaafar Lec. # 2
Binary Representation Introduction to Computer Science and Programming I Chris Schmidt.
Lecture 3 Number Representation 2 This week – Recap Addition – Addition circuitry – Subtraction of integers in binary – Representing numbers with fractional.
Binary & Decimal numbers = 3* * *10 + 5*1 = 3* * * *10 0 Decimal system: Ten digits: 0,1,2,3,…,9 Example:
Representations Example: Numbers –145 –CVL – –91 –
Assembly Language and Computer Architecture Using C++ and Java
Assembly Language and Computer Architecture Using C++ and Java
Number Systems Decimal (Base 10) Binary (Base 2) Hexadecimal (Base 16)
ECE 331 – Digital System Design
ECE 301 – Digital Electronics Number Systems and Conversion, Binary Arithmetic, and Representation of Negative Numbers (Lecture #10) The slides included.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Review Binary Basic Conversion Binary Decimal
The Binary Number System
Computer Systems 1 Fundamentals of Computing
COE 202: Digital Logic Design Number Systems Part 1
Binary Number Systems.
Binary Representation and Computer Arithmetic
Revision Introductory Lesson
Binary and Hexadecimal Numbers
Computer Systems 1 Fundamentals of Computing Negative Binary.
ECE 2110: Introduction to Digital Systems Signed Number Conversions.
Computers Organization & Assembly Language
Logic and data representation Revision. AND gate A B A B All inputs have to be true ( i.e 1) for the output of the gate to be high, in all other cases.
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
Number Systems Spring Semester 2013Programming and Data Structure1.
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 29, 2004 Lecture Number: 26.
Number Systems. Today Decimal Hexadecimal Binary –Unsigned Binary –1’s Complement Binary –2’s Complement Binary.
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.
Computer Number Systems. d n-1 d n-2 d n d 2-m d 1-m d -m Conventional Radix Number r is the radixd i is a digit d i Є {0, 1, ….., r – 1 } -m ≤
Number Systems ELEC 311 Digital Logic and Circuits Dr. Ron Hayne Images Courtesy of Cengage Learning.
ECE 331 – Digital System Design
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
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.
Number Systems Binary to Decimal Octal to Decimal Hexadecimal to Decimal Binary to Octal Binary to Hexadecimal Two’s Complement.
Chapter 19 Number Systems. Irvine, Kip R. Assembly Language for Intel-Based Computers, Translating Languages English: Display the sum of A times.
Number Systems and Logic Prepared by Dr P Marais (Modified by D Burford)
Chapter 1  Number Systems Decimal System Binary System Octal System Hexadecimal System  Binary weighted cods Signed number binary order  1’s and 2’s.
1 Review on Number Systems Decimal, Binary, and Hexadecimal.
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design Slide 1 of 14.
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Fri, Aug 28 CEC 220 Digital Circuit Design Slide 1 of 14.
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.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
1 EGR 277 – Digital Logic Syllabus Office Hours No food or drinks in the classrooms Web page (demonstration) Lecture #1 EGR 277 – Digital Logic Reading.
Lecture No. 4 Computer Logic Design. Negative Number Representation 3 Options –Sign-magnitude –One’s Complement –Two’s Complement  used in computers.
Binary Addition The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple, using a form of carrying:
1 Digital Logic Design (41-135) Chapter 5 Number Representation & Arithmetic Circuits Younglok Kim Dept. of Electrical Engineering Sogang University Spring.
ECE 2110: Introduction to Digital Systems Signed Number Conversions.
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
Binary & Decimal numbers
Design of Digital Circuits Reading: Binary Numbers
Addition and Subtraction
Programming and Data Structure
Digital Logic & Design Adil Waheed Lecture 02.
Negative numbers: Week 10 Lesson 1
Negative Binary Numbers
Introduction to Computing
Digital Logic & Design Dr. Waseem Ikram Lecture 02.
Negative Binary Numbers
CSE 102 Introduction to Computer Engineering
TAO1221 COMPUTER ARCHITECTURE AND ORGANIZATION LAB 6
Binary / Hex Binary and Hex The number systems of Computer Science.
Digital Logic & Design Lecture 02.
C1 Number systems.
Lecture No.5.
Computer Architecture CST 250
OBJECTIVES After reading this chapter, the reader should be able to :
Presentation transcript:

Number Representation 1 Lecture 2

Outcomes By the end of the session you should: – Understand what bits/bytes/words are. – Understanding conversion between binary, decimal and hexadecimal. – Understand how negative numbers can be stored.

Numbering Systems (Decimal) The counting system most commonly used by humans in the west, often believed to be based on the number of fingers on two hands. There are ten digits in this counting system

Numbering Systems (Binary) The two-state nature of logic gates means the use of 0 or 1, as the basic unit of the count is natural. Data is represented by binary digits (bits), words are groups of bits, but by convention the size of words are multiples of 8 bits (or a byte). bit furthest right as the least significant bit (lsb) and bit furthest left as the most significant bit as the most significant bit (msb).

Where we are only dealing with the positive integers the msb is the representation of largest power of 2, this as we will see later is not always true. In an n-bit word there are 2 n different combinations of bit, – so for 2 bits(n=2) there are 4 combinations, – for n=5 32 combinations.

Decimalmsb Lsb

Numbering system (Hexadecimal) A base-16 system with 16 possible digits {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}. Each hexadecimal number can be represented by 4 bits.

HexadecimalBinaryDecimal A B C D E F111115

Negative and Positive Numbers So far is the discussion no mention has been made about the being able to represent negative numbers, how can both negative and positive number be stored. Two methods – Sign and Magnitude – 2’s complement.

2’s complement There is an alternative, which allows addition and subtraction to be treated in the same way. 2’s complement has the ‘sign’ of the number built in. This achieved by the most significant bit the value –2 n-1 having a negative value so if n=8 this is –128 and the rest of the bits are unsigned bits.

2’s complement If was stored the msb =-128 and the rest equals 1 so the number is –128+1=-127. If was stored the msb =0 and the rest equals 1 so the number this time is 0+1=1

::::::::: ::::::::

So with 8-bit 2’s complement we can represent numbers between –128 and = = If we reverse all the bits in –126 we get if we add 1 to this we get

Starting Number = Reverse bits Add Positive to negative and back

Summary Introduced – Binary – Hexadecimal Storing negative and positive numbers – Sign and magnitude – 2’s complement.

Practical this week and Next Weeks sessions This weeks practical – Number representation – Adding binary numbers Next Week – Subtracting in binary – How do we represent number such as in a computer?

Further reading Chalk et al (2004) pg Tannebaum (2005) Pages 69-70,