Representations Example: Numbers –145 –CVL –10010001 –91 –

Slides:



Advertisements
Similar presentations
Representing Numbers: Integers
Advertisements

Integers. Integer Storage Since Binary consists only of 0s and 1s, we can’t use a negative sign ( - ) for integers. Instead, the Most Significant Bit.
Binary Representation Introduction to Computer Science and Programming I Chris Schmidt.
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.
Mathematics with Binary. Question  Below is a binary string  Which is the least significant bit (LSB)?  Which is the most significant bit (MSB)? 0.
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
Number System and Codes
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patterson and Hennessy Text.
COMP201 Computer Systems Number Representation. Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter.
Computer Science 101 Number Systems. Humans Decimal Numbers (base 10) Decimal Numbers (base 10) Sign-Magnitude (-324) Sign-Magnitude (-324) Decimal Fractions.
Number Systems Computer Science 210 Computer Organization.
Binary Number Systems.
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
3. Representing Integer Data
Binary Representation and Computer Arithmetic
Binary Representation - Shortcuts n Negation x + x = 1111…1111 two = -1 (in 2’s complement) Therefore, -x = x + 1 n Sign Extension o Positive numbers :
Computer Systems 1 Fundamentals of Computing Negative Binary.
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
ECE 2110: Introduction to Digital Systems Signed Number Conversions.
Simple Data Type Representation and conversion of numbers
ES 244: Digital Logic Design Chapter 1 Chapter 1: Introduction Uchechukwu Ofoegbu Temple University.
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
A-Level Computing Data representation. Objectives Know how data can be represented in a computer system Understand the need for various forms of representation.
Computer Science 111 Fundamentals of Programming I Number Systems.
Data Representation - Part I. Representing Numbers Choosing an appropriate representation is a critical decision a computer designer has to make The chosen.
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 29, 2004 Lecture Number: 26.
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.
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: The Logic of Compound Statements 2.5 Application: Number Systems and Circuits for Addition 1 Counting in binary is just like counting in decimal.
Cosc 2150: Computer Organization Chapter 2 Part 1 Integers addition and subtraction.
Introduction to Computing Dr. Nadeem A Khan. Lecture 10.
Number Representation
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.
1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 6, 2004 Lecture Number: 6.
AEEE2031 Data Representation and Numbering Systems.
By Jariya Phongsai A two's-complement system is a system in which negative numbers are represented by the two's complement of the absolute value; this.
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.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
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.
Computer Organization 1 Data Representation Negative Integers.
Lecture 2: 8/29/2002CS149D Fall CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
Software Design and Development Storing Data Computing Science.
Computer Science 210 Computer Organization
Topic: Binary Encoding – Part 1
Addition and Subtraction
Binary -ve and +ve numbers!.
Negative Binary Numbers
Introduction to Computing
Integer Real Numbers Character Boolean Memory Address CPU Data Types
Computer Science 210 Computer Organization
Negative Binary Numbers
CSE 102 Introduction to Computer Engineering
Lesson objectives Understand how computers represent and manipulate numbers [unsigned integers, signed integers (sign and magnitude, Two’s complement)
Number Systems.
Computer Science 210 Computer Organization
Data Representation in Computer Systems
Computer Science 210 Computer Organization
Computer Architecture CST 250
Presentation transcript:

Representations Example: Numbers –145 –CVL – –91 –

Meaning of Number Representation Examples: –145 = 1* * *10 0 Decimal –CVL = 100 – Roman – =1* * *2 0 Binary –91 = 9* *16 0 Hexadecimal – = Egypt – = 2* Babylon – =7* Maya

Meaning of Numbers: Convention/Agreement –Any number consists of symbols –The value of a number is defined by a set of rules of how to interpret these symbols –Most systems have a base number 10 Decimal 2 Binary 8 Octal 16 Hexadecimal

What makes a good representations? Meet certain constraints on the symbols Intuitive interpretation Can express everything you need !! Support for frequent operations –Efficiency –Space

What do we want to represent: Data Types Set of objects of the same “kind” Defined by –a way of representing each object –a group of operations to perform on such objects Basic data types of computer –integers (unsigned and signed) –plain text characters –bit vectors –(floating point numbers)

Computer Representation Computer representation: –Symbols: 0,1 –Words = sequence of k symbols (bit’s) –8 bit =1 byte notation for an unknown k -bit word: –a k-1 a k-2 … a 1 a 0 –a k- 1 is called the most significant bit –a 0 is called the least significant bit k is always a power of 2: 16 or 32

Unsigned Integer Representation 145=1* * *10 0 Decimal ui Binary =1*2 7 +0*2 6+ 0*2 5 +1*2 4 +0*2 3 +0*2 2 +0*2 1 +1*2 0 =1*128+0*64+0*32+1*16+0*8+0*4+0*2+1*0 =145 “Multiply and Add Algorithm”

How good is unsigned integer? Positive –Uses only 0 and 1 –Easy addition and conversion to decimal Negative –Limited size (2 k ) for k-bit word –No negative –Limited subtraction

Signed Integers need to represent both non-negative and negative integers need to be able to perform the following operations –addition (using the same rules as before) –negation –subtraction (trivial) three different representations will be considered –in all three representations words whose most significant bit –is 0 represent the same non-negative integer

Signed Magnitude Most significant bit determines whether the number is positive (a k-1 =0, as before ) or negative (a k-1 =1) k= (-6) (+7) (+5) + –We now have negative numbers –Easy negation, only change first bit - –Addition does not work anymore Does not work!

One’s Compliment Positive number as before Negation is performed by inverting all bits Example: -6 = Inverse (6) = Inverse (0110) = 1001 “test” addition by adding 1001 with (-6) (+7) (0) Does not work!

Two’s Compliment Positive as before Negation is performed by inverting all of the bits, and then adding 1 (binary) -6 = Inverse(6)+0001 = Inverse(0110)+0001 = =0111 “test” addition by adding 1010 with (-6) (+7) (+1) Two’s compliment is useful for representing signed integers

Things you should be able to do Convert decimal number to binary and vice versa to all 4 forms of binary representation Addition in unsigned integer Addition and subtraction for two’s complement Negation in two’s complement Recognize the different subscripts: ui, sm, 1c,2c Understand why 2c is better than sm Know which representation (of the 4) is used for integer