CS 101 – Sept. 2 Chapter 3: data representation Many kinds of data  all in binary Today: integers –Unsigned –Signed Later: text, images, code, etc.

Slides:



Advertisements
Similar presentations
Chapter 2: Data Representation
Advertisements

Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 2: Data Representation.
CS 61C L02 Number Representation (1)Harvey / Wawrzynek Fall 2003 © UCB 8/27/2003  Brian Harvey ( John Wawrzynek  (Warznek) (
J. Michael Moore Computer Organization CSCE 110. J. Michael Moore High Level View Of A Computer ProcessorInputOutput Memory Storage.
Wakerly Section 2.4 and further Addition and Subtraction of Nondecimal Numbers.
CS 61C L02 Number Representation (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C.
J. Michael Moore Computer Organization CPSC 110. J. Michael Moore High Level View Of A Computer ProcessorInputOutput Memory Storage.
2-1 Computer Organization Part Fixed Point Numbers Using only two digits of precision for signed base 10 numbers, the range (interval between lowest.
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
Number Representation (1) Fall 2005 Lecture 12: Number Representation Integers and Computer Arithmetic.
Signed Numbers CS208. Signed Numbers Until now we've been concentrating on unsigned numbers. In real life we also need to be able represent signed numbers.
Binary Numbers.
Number Systems Computer Science 210 Computer Organization.
1.6 Signed Binary Numbers.
Introduction to Computing Systems from bits & gates to C & beyond Chapter 2 Bits, Data Types & Operations Integer Representation Floating-point Representation.
ECE 2110: Introduction to Digital Systems Signed Number Conversions.
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
1 Week 3: Data Representation: Negative Numbers READING: Chapter 3.
CENG 311 Machine Representation/Numbers
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Lecture 5.
Computers Organization & Assembly Language
Working with text ASCII and UNICODE.   
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Computer Science 111 Fundamentals of Programming I Number Systems.
Chapter 1 Data Storage(3) Yonsei University 1 st Semester, 2015 Sanghyun Park.
Data Representation - Part I. Representing Numbers Choosing an appropriate representation is a critical decision a computer designer has to make The chosen.
Foundations of Computer Science Computing …it is all about Data Representation, Storage, Processing, and Communication of Data 10/4/20151CS 112 – Foundations.
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer.
Complement Numbers. Outline  Negative Numbers Representation  Sign-and-magnitude  1s Complement  2s Complement  Comparison of Sign-and-Magnitude.
CPS120: Introduction to Computer Science Computer Math: Signed Numbers.
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 20, 2004 Lecture Number: 23.
10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept Representing Information in Computers:  numbers: counting numbers,
Representation of Data Ma King Man. Reference Text Book: Volume 2 Notes: Chapter 19.
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
Number Systems and Codes. CS2100 Number Systems and Codes 2 NUMBER SYSTEMS & CODES Information Representations Number Systems Base Conversion Negative.
1 EENG 2710 Chapter 1 Number Systems and Codes. 2 Chapter 1 Homework 1.1c, 1.2c, 1.3c, 1.4e, 1.5e, 1.6c, 1.7e, 1.8a, 1.9a, 1.10b, 1.13a, 1.19.
BR 8/99 Binary Numbers Again Recall than N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to 255.
Number Representation
Negative Bit Representation Lesson CS1313 Spring Negative Bit Representation Outline 1.Negative Bit Representation Outline 2.Negative Integers 3.Representing.
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.
CS 101 – Aug. 31 Interpreting binary  decimal √ Decimal  binary Shorthand ways of expressing binary –Octal –“Hex” Negative numbers.
AEEE2031 Data Representation and Numbering Systems.
Introduction to Microprocessors Chapter 2. Decimal or Base 10 Numbers  Have ten different digits (0-9)  It is a weighted number system. Each position.
COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.6 Instructor: Lin Chen Sept 2013.
CS1Q Computer Systems Lecture 2 Simon Gay. Lecture 2CS1Q Computer Systems - Simon Gay2 Binary Numbers We’ll look at some details of the representation.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
CSE1301 Computer Programming Lecture 32: Number Representation
1 COMS 161 Introduction to Computing Title: Computing Basics Date: September 8, 2004 Lecture Number: 7.
Negative Integers Unsigned binary representation can not be used to represent negative numbers. With paper and pencil arithmetic, a number is made negative.
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.
1 Ethics of Computing MONT 113G, Spring 2012 Session 4 Binary Addition.
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
Nguyen Le CS147.  2.4 Signed Integer Representation  – Signed Magnitude  – Complement Systems  – Unsigned Versus Signed Numbers.
ECE 3110: Introduction to Digital Systems Signed Number Conversions and operations.
1 Integer Representations V1.0 (22/10/2005). 2 Integer Representations  Unsigned integer  Signed integer  Sign and magnitude  Complements  One’s.
Lecture 4: Digital Systems & Binary Numbers (4)
Binary & Hex Review.
Binary -ve and +ve numbers!.
Negative Integers Unsigned binary representation can not be used to represent negative numbers. With paper and pencil arithmetic, a number is made negative.
3.1 Denary, Binary and Hexadecimal Number Systems
Chapter 3 Data Storage.
Computer Science 210 Computer Organization
Wakerly Section 2.4 and further
Computer Science 210 Computer Organization
Chapter 2 Bits, Data Types & Operations Integer Representation
CS 101 – Sept. 4 Number representation Integer Unsigned √ Signed √
Presentation transcript:

CS 101 – Sept. 2 Chapter 3: data representation Many kinds of data  all in binary Today: integers –Unsigned –Signed Later: text, images, code, etc.

Different kinds of data! Kind of dataFile typeSoftware used Numbers.xlsx.accdb Excel Access Text.txt.docx.html NotePad MS Word Dreamweaver Image.gifPhotoshop Instructions.exeThe operating system

Converting to binary A computer system has both HW & SW HW: only understands binary SW: Translates human information into binary for the HW. How? –Break into pieces (digits, words, letters, symbols, pixels, …) –Each piece individually gets a binary number.

Data vs. information What does mean to you? Or is it just a random number? What might … mean to the computer? Information means that we are adding “meaning” to the data Binary is like the alphabet… all languages use it to give meaning to letters. What is “pet set” ?

Analog vs. Digital Analog is how WE understand the world Just “warmer” or “crooked” is enough for us Can handle “in between” values Think of a clock, speedometer, odometer Digital emphasizes exact values, usually expressed as 0 or 1, true or false. No such thing as “in between.” It’s either 10:30 or 10:31…

An analogy Think of the notes on a piano. 88 keys Range: from lowest to highest key. Granularity: distance between consecutive notes. But for computer, notes are converted to binary numbers!

Representations To represent anything in binary, need to know: –Number of bits? (size) –What do the bits mean? (scheme) Representation schemes for integers: –unsigned –signed –sign magnitude –BCD

Size of rep’n Most often 8, 16, or 32 bits For our examples, we’ll use small sizes 5 bits: 2 5 different numbers 32 bits: 2 32 different numbers

Scheme I: Unsigned Ordinary binary number.  For 5 bits: smallest = (zero) largest = (31) In general, smallest = 0, largest = 2 n – 1. Going beyond possible range: “overflow”

Scheme II: Signed Allows for negative numbers We want half the rep’ns to be negative. Ex. 5 bits  32 numbers. –16 numbers are negative –Thus, range is –16 to +15. For n bits: range is –2 n–1 to 2 n – 1 – 1

How to represent negatives In unsigned, impossible! In signed: 3 steps to represent –x: –Find rep’n of +x. –Invert the bits. –Add 1. Try some examples.

Closer look at signed In 5 bits: largest number is (+15) lowest number is (–16) Leftmost bit is sign bit Positive #’s have same rep’n as unsigned. Technique for –x doesn’t work for –16.

Recap example What does represent if interpreted as: –6 bit unsigned? –6 bit signed?