Data Representation. How is data stored on a computer? Registers, main memory, etc. consists of grids of transistors Transistors are in one of two states,

Slides:



Advertisements
Similar presentations
The Binary Numbering Systems
Advertisements

Lecture - 2 Number systems and computer data formats
2-1 Chapter 2 - Data Representation Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer Architecture.
Chapter 2: Data Representation
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, Java Version, Third Edition.
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, C++ Version, Third Edition.
Connecting with Computer Science, 2e
Representing Information as Bit Patterns
Chapter 5 Floating Point Numbers. Real Numbers l Floating point representation is used whenever the number to be represented is outside the range of integer.
Chapter 3 Data Representation.
Introduction to Programming with Java, for Beginners
Chapter 3 Data Representation. Chapter goals Describe numbering systems and their use in data representation Compare and contrast various data representation.
2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.
Introduction to Computers and Programming. Some definitions Algorithm: Algorithm: A procedure for solving a problem A procedure for solving a problem.
1 A Balanced Introduction to Computer Science, 2/E David Reed, Creighton University ©2008 Pearson Prentice Hall ISBN Chapter 12 Data.
Computer Science 210 Computer Organization Floating Point Representation.
Binary Number Systems.
Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.
Binary Representation and Computer Arithmetic
Chapter 5 Data representation.
Simple Data Type Representation and conversion of numbers
Lecture 5.
Binary Representation. Binary Representation for Numbers Assume 4-bit numbers 5 as an integer  as an integer  How? 5.0 as a real number  How?
Computing Higher - Unit 1… Computer Systems 1 Higher Computing Unit 1 – Topic 1 Data Representation.
Computers Organization & Assembly Language
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
Computer Math CPS120: Data Representation. Representing Data The computer knows the type of data stored in a particular location from the context in which.
IT253: Computer Organization
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.
Data Representation and Computer Arithmetic
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Idea 1: Bits Two states in a digital machine: 1.presence of.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Binary, Decimal and Hexadecimal Numbers Svetlin Nakov Telerik Corporation
Computer Systems Organization CS 1428 Foundations of Computer Science.
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
Floating Point (a brief look) We need a way to represent –numbers with fractions, e.g., –very small numbers, e.g., –very large numbers,
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
1 Lecture 2  Complement  Floating Point Number  Character Encoding.
ITEC 1011 Introduction to Information Technologies 4. Floating Point Numbers Chapt. 5.
Chapter 1 Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
CISC1100: Binary Numbers Fall 2014, Dr. Zhang 1. Numeral System 2  A way for expressing numbers, using symbols in a consistent manner.  " 11 " can be.
1 Representation of Data within the Computer Oct., 1999(Revised 2001 Oct)
1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 6, 2004 Lecture Number: 6.
Data Representation, Number Systems and Base Conversions
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
1 Information Representation in Computer Lecture Nine.
Data Representation. What is data? Data is information that has been translated into a form that is more convenient to process As information take different.
Data Representation: Floating Point for Real Numbers Computer Organization and Assembly Language: Module 11.
Computer Science I Storing data. Binary numbers. Classwork/homework: Catch up. Do analysis of image types.
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
Topic: Binary Encoding – Part 1
Invitation to Computer Science, C++ Version, Fourth Edition
Bits, Data Types, and Operations
Chapter 2 Bits, Data Types, and Operations
Lec 3: Data Representation
Number Representation
Data Representation Binary Numbers Binary Addition
Digital Electronics Jess 2008.
Binary, Decimal and Hexadecimal Numbers
Invitation to Computer Science, Java Version, Third Edition
Data Representation Data Types Complements Fixed Point Representation
Arithmetic Logical Unit
Plan Attendance Files Posted on Campus Cruiser Homework Reminder
Storing Negative Integers
How Computers Store Data
How Computers Work Part 1 6 February 2008.
Storing Integers and Fractions
COMS 161 Introduction to Computing
Presentation transcript:

Data Representation

How is data stored on a computer? Registers, main memory, etc. consists of grids of transistors Transistors are in one of two states, on or off Each transistor can represent one digit in a base 2 (binary) number All data must be converted to this form before it is stored in memory

Numeric (integer) data There are straightforward algorithms to convert integers in decimal and other bases to binary One bit is reserved to represent the sign of the number (signed magnitude representation) Examples in 8 bits: = =

Hexadecimal Representation Decimal is relatively difficult to convert because the decimal digits of the number don't match up with groups of bits in the binary representation Base 8 (octal) and base 16 (hexadecimal) are easier because each digit corresponds to 3 or 4 bits in the binary representation.

The hexadecimal number system DecimalHexBinaryDecimalHexBinary A B C D E F1111

Example D F B Uses: HTML – representing color strings #FFCCFF First two digits are red component, next two are green, final two are blue HTML character entities &#169 is the character entity for the copyright symbol

Numeric (decimal) data We also need to store numbers like Like integers, there are a set number of bits that are used to represent decimal numbers To simplify the problem, we use scientific notation: = x 10 3 (except in binary)

IEEE Floating Point Format mantissa – the significant digits of the number, normalized so that there is one digit to the left of the decimal point (binary point, in this case) (also called "significand") exponent – power to which the mantissa is raised to get the original value sign bit – 0 for positive numbers, 1 for negative numbers

Numeric representation Gotchas Computers use a finite number of bits to store numeric data Some numbers are too big (or small) to fit in the available number of bits – overflow (or underflow) How many places after the decimal does 1/3 have? How about pi? Floating point representations are APPROXIMATIONS!

Textual Data How would you store "siphonapterology" in a computer's memory?

Textual Data How would you store "siphonapterology" in a computer's memory? We must find a way to encode the characters as numbers

Textual Data How would you store "siphonapterology" in a computer's memory? We must find a way to encode the characters as numbers ASCII – a simple encoding for the Latin alphabet, uses 7 bits per character, each character fits into one byte.

Textual Data How would you store "siphonapterology" in a computer's memory? We must find a way to encode the characters as numbers ASCII – a simple encoding for the Latin alphabet, uses 7 bits per character, each character fits into one byte. Unicode – 16 bits per character,works for more complex character sets

Images Divided into squares called pixels Each pixel is represented by a number The number encodes the color used to display that pixel

Programs? Programs must be stored in memory, too Every computer type has a "machine language instruction set" Each instruction has a binary code

What is it? A 32 bit negative integer value? A 32 bit negative floating point number? Four characters in ASCII encoding? Two characters in Unicode? Pixels from an image? Samples from a sound file? An instruction from a program? It depends – on how the value is used in the execution of a program.