Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.

Slides:



Advertisements
Similar presentations
Data Representation COE 202 Digital Logic Design Dr. Aiman El-Maleh
Advertisements

The Binary Numbering Systems
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
Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 2: Data Representation.
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Data Representation Computer Organization &
Data Representation COE 205
Connecting with Computer Science, 2e
Introduction to Programming with Java, for Beginners
2-1 Computer Organization Part Fixed Point Numbers Using only two digits of precision for signed base 10 numbers, the range (interval between lowest.
Data Representation ICS 233
Data Representation in Computers
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Binary Number Systems.
Binary Representation and Computer Arithmetic
Chapter 5 Data representation.
The Binary Number System
Data Representation Number Systems.
(2.1) Fundamentals  Terms for magnitudes – logarithms and logarithmic graphs  Digital representations – Binary numbers – Text – Analog information 
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Simple Data Type Representation and conversion of numbers
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Lecture 5.
Numeral Systems Subjects: Numeral System Positional systems Decimal
Data Representation – Binary Numbers
Computers Organization & Assembly Language
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
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.
Data Representation and Computer Arithmetic
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Number Systems Spring Semester 2013Programming and Data Structure1.
Compsci Today’s topics l Binary Numbers  Brookshear l Slides from Prof. Marti Hearst of UC Berkeley SIMS l Upcoming  Networks Interactive.
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
Computer Systems Architecture Copyright © Genetic Computer School 2008 CSA 1- 0 Lesson 1 Number System.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Compsci Today’s topics l Binary Numbers  Brookshear l Slides from Prof. Marti Hearst of UC Berkeley SIMS l Upcoming  Networks Interactive.
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 6, 2004 Lecture Number: 6.
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.
Data Representation, Number Systems and Base Conversions
Number Systems Denary Base 10 Binary Base 2 Hexadecimal Base 16
1 Information Representation in Computer Lecture Nine.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
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,
Representing Sound and Image. Representing images One mean of representing an image it to interpret the image as a collection of dots, each is called.
Data Representation COE 301 Computer Organization Dr. Muhamed Mudawar
 Computers are 2-state devices › Pulse – No pulse › On – Off  Represented by › 1 – 0  BINARY.
CHAPTER 3 BINARY NUMBER SYSTEM. Computers are electronic machines which operate using binary logic. These devices use two different values to represent.
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.
Digital logic COMP214  Lecture 2 Dr. Sarah M.Eljack Chapter 1 1.
Data Representation COE 301 Computer Organization Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum.
Dr. ClincyLecture 2 Slide 1 CS Chapter 2 (1 of 5) Dr. Clincy Professor of CS Note: Do not study chapter 2’s appendix (the topics will be covered.
CS2100 Computer Organisation
Data Representation COE 308 Computer Architecture
Computer Science: An Overview Eleventh Edition
Data Representation ICS 233
Lec 3: Data Representation
Data Representation.
CS1010 Programming Methodology
Data Representation COE 301 Computer Organization
Numbering System TODAY AND TOMORROW 11th Edition
How Computers Store Data
Data Representation ICS 233
Data Representation COE 308 Computer Architecture
Presentation transcript:

Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn how numbering systems are used to count Understand the significance of positional value in a numbering system Learn the differences and similarities between numbering system bases

Connecting with Computer Science 3 Objectives (continued) Learn how to convert numbers between bases Learn how to do binary and hexadecimal math Learn how data is represented as binary in the computer Learn how images and sounds are stored in the computer

Connecting with Computer Science 4 Why You Need to Know About... Numbering Systems Computers store programs and data in binary code Understanding of binary code is key to machine Binary number system is point of departure Hexadecimal number system –Provides convenient representation –Written into error messages

Connecting with Computer Science 5 Powers of Numbers - A Refresher Raising a number to a positive power (exponent) –Self-multiply the number by the specified power –Example: 2 3 = 2 * 2 * 2 = 8 (asterisk = multiplication) –Special cases: 0 and 1 as powers Any number raised to 0 = 1; e.g, 10,555 0 = 1. Any number raised to 1 = itself; e.g., 10,555 1 = 10,555

Connecting with Computer Science 6 Powers of Numbers -A Refresher (continued) Raising a number to a negative power –Follow same steps for positive power –Divide result into 1; e.g., 2 -3 = 1/ (2 3 ) =.125

Connecting with Computer Science 7 Counting Things Numbers are used to count things –Base 10 (decimal) most familiar The computer uses base 2, called binary –Base 2 has two unique digits: 0 and 1

Connecting with Computer Science 8 Counting Things (continued) Hexadecimal system used to represent binary digits –Base 16 has sixteen unique digits: 0 – 9, A - F Counting for all number systems similar –Count digits defined in number system until exhausted –Place zero in ones column. Carry one to the left

Connecting with Computer Science 9 Positional Value Weight assigned digit based on position in number –Determine positional value of each digit by raising 10 to position within number –Determine digit’s contribution to overall number by multiplying digit by positional value –Consider 5 in (radix = 10 = decimal point) Positional value = 10 1 Overall contribution = 5 x 10 1 = 50

Connecting with Computer Science 10

Connecting with Computer Science 11 Positional Value (continued) Number: sum of products of each digit and positional value –Example: = 3 x x x x x x x Numbers in all bases can be defined by position –Base 2: Multiply each digit by 2 digit position –Base 16: Multiply each digit by 16 digit position –Base b: Multiply each digit by b digit position

Connecting with Computer Science 12

Connecting with Computer Science 13 How Many Things Does A Number Represent Number = sum of each digit x positional value –Translate number of things to accord with base 10 –e.g.: is equivalent to nine things = (1 * 2 0 ) + (0 * 2 1 ) + (0 * 2 2 ) + (1 * 2 3 ) General procedure for evaluating numbers (any base) 1.Calculate the value for each position of the number by raising the base value to the power of the position 2.Multiply positional value by digit in that position 3.Add each of the calculated values together

Connecting with Computer Science 14 Converting Numbers Between Bases Any quantity can be represented by some number in any base Counting process similar for all bases 1.Count until highest digit for base reached 2.Add 1 to next higher position to left 3.Return 0 to current position Conversion is a map from one base to another –Identities can be easily calculated –Identities may also be obtained by table look-up

Connecting with Computer Science 15

Connecting with Computer Science 16 Converting To Base 10 Three methods: 1.Table look-up (more extensive than Table 4-1) 2.Calculator 3.Algorithm for evaluating number in any base Example: consider 169AE in base 16 –Identify base: 16 –Map positions to digits: –Raise, multiply and add: 169AE = (1 x 16 4 ) + (6 x 16 3 ) + (9 x 16 2 ) + (10 x 16 1 ) + (14 x 16 0 ) = 92,590

Connecting with Computer Science 17 Converting From Base 10 Three methods: 1.Table look-up (more extensive than Table 4-1) 2.Calculator

Connecting with Computer Science 18 Converting From Base 10 (continued) 3.Algorithm for converting from base 10 1.Divide the decimal number by the number of the target base (for example, 2 or 16) 2.Write down the remainder 3.Divide the quotient of the prior division by the base again 4.Write the remainder to the left of the last remainder written 5.Repeat Steps 3 and 4 until the whole number result is 0

Connecting with Computer Science 19 Converting From Base 10 (continued) Practice conversion algorithm: find hexadecimal equivalent of decimal 45 –Divide 45 by 16 (base) –Write down remainder D –Divide 2 by 16 –Write down remainder 2 to the left of D (2D) –Stop since reduced quotient = 0 –Check: 2D = (2 x 16 1 ) + (13 x 16 0 ) = = 45

Connecting with Computer Science 20 Binary And Hexadecimal Math Procedure for adding numbers similar in all bases –Difference lies in carry process –Value of carry = value of base –Example: –Carry value for above = 10 2 = (1 x x 10 0 ) = 2 10 Procedure for subtraction, multiplication, and division also similar

Connecting with Computer Science 21

Connecting with Computer Science 22 Data Representation In Binary Binary values map to two-state transistors Bit: fundamental logical/physical unit (1/0 = on/off) Byte: grouping of eight bits (nibble = ½ byte) Word: collection of bytes (4 bytes is typical) Hexadecimal used as binary shorthand –Relate each hexadecimal digit to 4-bit binary pattern –Example: = F A C E (see Table 4-1)

Connecting with Computer Science 23 Representing Whole Numbers Whole numbers stored in fixed number of bits – stored as 16-bit integer Signed numbers stored with two’s complement –Left most bit reserved for sign (1 = neg and 0 = pos) –If positive, store with leading zeroes to fit field –If negative, perform two’s complement Reverse bit pattern Add 1 to number using binary addition

Connecting with Computer Science 24

Connecting with Computer Science 25 Representing Fractional Numbers Computers store fractional numbers (neg and pos) Storage technique based on floating-point notation –Example of floating point number: E+5 –1.345 = mantissa, E = exponent, + 5 moves decimal IEEE-754 specification uses binary mantissas and exponents Implementation details part of advanced study

Connecting with Computer Science 26 Representing Characters Computers store characters according to standards ASCII –Represents characters with 7-bit pattern –Provides for upper and lowercase English letters, numeric characters, punctuation, special characters –Accommodates 128 (2 7 ) different characters Globalization places upward pressure –Extended ASCII: allows 8-bit patterns (256 total) –Unicode: defined for 16 bit patterns (34,168 total)

Connecting with Computer Science 27 Representing Images Screen image made up of small dots of colored light –Dot called “pixel” (picture element), smallest unit –Resolution: # pixels in each row and column –Each pixel is stored in the computer as a binary pattern RGB encoding –Red, blue, and green assigned to eight of 24 bits –White represented with 1s, black with 0s –Color is the amount of red, green, and blue specified in each of the 8-bit sections

Connecting with Computer Science 28 Representing Images (continued) Images, such as photos, stored with pixel-based technologies Large image files can be compressed (JPG, GIF formats) Moving images can also be compressed (MPEG, MOV, WMV )

Connecting with Computer Science 29 Representing Sounds Sound represented as waveform with –Amplitude (volume) and –Frequency (pitch) Computer samples sounds at fixed intervals –Samples given a binary value according to amplitude –# bits in each sample determines amplitude range –For CD-quality audio Sound must be sampled over 44,000 times a second Samples must allow > 65,000 different amplitudes

Connecting with Computer Science 30

Connecting with Computer Science 31 One Last Thought Binary code is the language of the machine Knowledge of base 2 and base 16 prerequisite to knowledge of machine language Computer scientists are more effective with binary and hexadecimal concepts

Connecting with Computer Science 32 Summary Knowledge of alternative number systems essential Machine language based on binary system Hexadecimal used to represent binary numbers Power rule for numbers defines self-multiplication Any number can be represented in any base

Connecting with Computer Science 33 Summary (continued) Positional value: weight based on digit position Counting processes similar for all bases Conversion between bases is one-to-one mapping Arithmetic defined for all bases Data representation: bits, nibbles, bytes, words

Connecting with Computer Science 34 Summary (continued) Two’s complement: technique for storing signed numbers Floating point notation: system used to represent fractions and irrationals ASCII and Unicode: character set standards Image representation: based on binary pixel Sound representation: based on amplitude samples