Abstraction – Number Systems and Data Representation.

Slides:



Advertisements
Similar presentations
Number Systems and Codes
Advertisements

Lecturer: Omid Jafarinezhad Sharif University of Technology Department of Computer Engineering 1 Fundamental of Programming (C) Lecture 2 Number Systems.
Binary Representation Introduction to Computer Science and Programming I Chris Schmidt.
Digital Fundamentals Floyd Chapter 2 Tenth Edition
CSC /703 CTI/DePaul1 CSC-255 Lecture 3 Text and Numerical Storage (Chapter 1 from Brookshear) Modified by Ufuk Verun from Jim Janossy © 2002, DePaul.
Binary and Hexadecimal Numbers
Binary Expression Numbers & Text CS 105 Binary Representation At the fundamental hardware level, a modern computer can only distinguish between two values,
2-1 Computer Organization Part Fixed Point Numbers Using only two digits of precision for signed base 10 numbers, the range (interval between lowest.
28-Jun-15 Number Systems. 2 Bits and bytes A bit is a single two-valued quantity: yes or no, true or false, on or off, high or low, good or bad One bit.
1 12/08/03SW Abingdon and Witney College Binary Converting to and from decimal.
The Binary Number System
Binary Numbers.
Data Representation in Computers. Data Representation in Computers/Session 3 / 2 of 33 Number systems  The additive approach – Number earlier consisted.
Intro CS, Computers, Programming Introduction to Computer Science, Computers, and Programming Barbara Ericson Georgia Tech Aug 2009.
Bits, Bytes, KiloBytes, MegaBytes, GigaBytes & TeraBytes.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Memory Terminology & Data Representation CSCI 1060 Fall 2006.
Numbering systems.
Numbering Systems CS208.
Georgia Institute of Technology Introduction to Programming Part 2 Barb Ericson Georgia Institute of Technology May 2006.
How Computers Work Dr. John P. Abraham Professor UTPA.
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
Binary Arithmetic & Data representation
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.
Computing Theory – F453 Number Systems. Data in a computer needs to be represented in a format the computer understands. This does not necessarily mean.
Computer Systems Architecture Copyright © Genetic Computer School 2008 CSA 1- 0 Lesson 1 Number System.
Chapter 7—Objects and Memory The Art and Science of An Introduction to Computer Science ERIC S. ROBERTS Java Objects and Memory C H A P T E R 7 Yea, from.
The Hexadecimal Number System and Memory Addressing ISAT 121.
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
Data Representation, Number Systems and Base Conversions
Number Bases and Representation. Denary Number System (Base 10) Our number system uses 10 digits (0-9) As you move from right to left each number is worth.
Data Representation Bits, Bytes, Binary, Hexadecimal.
Addition and Substraction
Binary01.ppt Decimal Decimal: Base 10 means 10 Unique numerical digits ,00010,000 Weight Positions 3,
Data Representation (in computer system). Data Representation How do computers represent data? b The computers are digital Recognize.
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
MECH1500 Chapter 3.
Number Representation Lecture Topics How are numeric data items actually stored in computer memory? How much space (memory locations) is.
Georgia Institute of Technology Introduction to Programming Part 3 Barb Ericson Georgia Institute of Technology May 2006.
Chapter 1 Representing Data in a Computer. 1.1 Binary and Hexadecimal Numbers.
Number Systems. Topics  The Decimal Number System  The Binary Number System  Converting from Binary to Decimal  Converting from Decimal to Binary.
Nguyen Le CS147.  2.4 Signed Integer Representation  – Signed Magnitude  – Complement Systems  – Unsigned Versus Signed Numbers.
 Computers are 2-state devices › Pulse – No pulse › On – Off  Represented by › 1 – 0  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.
Some basic concepts underlying computer archi­tecture
Binary & Hex Review.
Programming and Data Structure
Number Systems and Codes
Introduction to Programming Part 2
3.1 Denary, Binary and Hexadecimal Number Systems
What is a byte? What is it? How would you use it?
CSCI 198: Lecture 4: Data Representation
Integer Real Numbers Character Boolean Memory Address CPU Data Types
CSCI 161: Lecture 4: Data Representation
What is Binary? Binary is a two-digit (Base-2) numerical system, which computers use to process and store data. The reason computers use the binary system.
Introduction to Programming Part 3
Number Systems and Codes
Dr. Clincy Professor of CS
Introduction to Programming Part 2
Plan Attendance Files Posted on Campus Cruiser Homework Reminder
How Computers Store Data
Chapter Four Data Representation in Computers By Bezawit E.
Introduction to Programming Part 3
Binary System.
Abstraction – Number Systems and Data Representation
Binary & Hex Review.
Presentation transcript:

Abstraction – Number Systems and Data Representation

Memory Computer memory is used to store data The smallest unit of memory is a bit (Binary digIT) A bit can be off (no voltage) or on (has voltage) which we interpret to be 0 or 1 Memory is organized into 8 bit contiguous groups called bytes. A megabyte is 1,048,576 bytes (over 1 million bytes). A gigabyte is over 1 billion bytes.

How does Memory Represent Values? The different patterns of the on and off bits in a byte determine the value stored Numbers are stored using binary numbers – 101 is 1 * * * 2 2 = 5 Characters are internally represented as numbers – Different numbers represent different characters – There are several systems for assigning numbers to characters: ASCII, EBCDIC, and Unicode

Encodings Make Computers Powerful Voltages are interpreted as numbers Numbers can be interpreted as characters Characters can be interpreted to be part of a link to Sun ’ s Java SiteSun ’ s Java Site off on off off off off off on a Sun ’ s Java Site

Notepad Exercise Open notepad and type a sentence in it Save the file Check the size in bytes by leaving the cursor over the file name – Or right click and check properties Now count the number of letters and spaces

Binary Numbers A bit is a binary digit with a value of 0 or 1 –A group of 8 bits is a byte Computer memory is allocated in bytes Numbers are stored using the binary number system –With digits of 0 or 1 and powers of 2 Other number systems –Decimal- digits of 0 to 9 and powers of 10 –Octal - digits of 0 to 7 and powers of 8 –Hexadecimal – digits of 0 to 9 and A, B, C, D, E, F and powers of DrawingInJava 6

Converting from Binary to Decimal Multiply the digit value times the place value and add up the results to convert from binary to decimal The place values start with 2 0 on the right (which is 1) and increase to the left 7

Converting from Decimal to Binary Subtraction Method Keep subtracting out largest power of two until nothing remains 8

Converting from Decimal to Binary Division Method Read result from top to bottom. 9

Binary Addition To add two decimal numbers you add the digits and if the total is greater than ten you carry the one into the next column To add two binary numbers – = 0 – and = 1 – = 0 with a carry of 1 into the next column to the left

2 ’ s Compliment Notation Computers actually only know how to add – So, how do they handle subtraction? Computers subtract by adding a negative number How do you represent a negative number in memory? – Positive numbers in 2 ’ s compliment are just the same as a binary number – For negative numbers reverse 0s and 1s and then add 1

2 ’ s Compliment Example To subtract 3 from 7 First represent both as a binary number – 7 is – 3 is Reverse the 0s and 1s and then add 1 to get -3 – reversed is – add – The result is

Add the Negative Number To subtract 3 from 7 Add -3 to 7 – 7 is – -3 is – The result is Throw away the leftmost 1 The answer is which is 4

Patterns Exercise How many different patterns of on and off bits are there in 3 bits? How many in 4 bits? How many in 8 bits? 000 is one pattern 001 is another pattern 010 is another pattern

Does the number of patterns matter? Some garage door openers in the 70s used 8 bits to set the code to use to open the door – Giving 256 different patterns – Which is enough that you won ’ t open your neighbors door – But small enough that someone could try each one

Remote Entry Systems With 8 bits for a code you have a 1/256 chance of a random code working – You don ’ t want someone opening your car in a place with lots of cars (like a mall) There are also radio scanners that can capture your code – So you want the code to change each time Modern remote entry systems use a 40 bit rolling code