Fall’ 2014 Lesson - 1 Number System & Program Design CSE 101.

Slides:



Advertisements
Similar presentations
Transforming Data into Information lesson 7 This lesson includes the following sections: How Computers Represent Data How Computers Process Data Factors.
Advertisements

Number Systems and Codes
DATA REPRESENTATION CONVERSION.
SECTION 4a Transforming Data into Information.
Company LOGO Edit your slogan here DKT 122/3 DIGITAL SYSTEM 1 WEEK #3 NUMBER SYSTEMS, OPERATION & CODES (PART 2)
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Representing Information as Bit Patterns Lecture 4 CSCI 1405, CSCI 1301 Introduction to Computer Science Fall 2009.
Number Systems Decimal (Base 10) Binary (Base 2) Hexadecimal (Base 16)
Data Representation in Computers
1 Number Systems. 2 Numbers Each number system is associated with a base or radix – The decimal number system is said to be of base or radix 10 A number.
Number Systems and Arithmetic
Binary Numbers.
CCE-EDUSAT SESSION FOR COMPUTER FUNDAMENTALS Date: Session III Topic: Number Systems Faculty: Anita Kanavalli Department of CSE M S Ramaiah.
COMPUTER FUNDAMENTALS David Samuel Bhatti
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
Revision Introductory Lesson
Number Systems and Codes
Number Systems.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Numbering systems.
CSC212 – Computer Organization and Design
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
Transforming Data into Information.
Copyright © 2003 by Prentice Hall Module 5 Central Processing Unit 1. Binary representation of data 2. The components of the CPU 3. CPU and Instruction.
Comp Sci 251 Intro 1 Computer organization and assembly language Wing Huen.
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 SYSTEM AND COMPUTER CODES Chapter 2. Prelude Fingers, sticks, and other things for counting were not enough! Counting large numbers Count in groups.
Number Systems Spring Semester 2013Programming and Data Structure1.
Introduction to Computer Design CMPT 150 Section: D Ch. 1 Digital Computers and Information CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU 1.
Number systems: binary, decimal, hexadecimal and octal. Conversion between various number systems Number systems: binary, decimal, hexadecimal and octal.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
Number Systems and Codes. CS2100 Number Systems and Codes 2 NUMBER SYSTEMS & CODES Information Representations Number Systems Base Conversion Negative.
Computer Systems Architecture Copyright © Genetic Computer School 2008 CSA 1- 0 Lesson 1 Number System.
Number systems, Operations, and Codes
Number Systems and Codes
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
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.
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
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.
Computer Number System
Chapter 1 Number Systems Digital Electronics. Topics discussed in last lecture Digital systems Advantages of using digital signals over analog. Disadvantages.
CPEN Digital Logic Design Binary Systems Spring 2004 C. Gerousis © Digital Design 3 rd Ed., Mano Prentice Hall.
Chapter 1 : Introduction to Binary Systems 1.1. Introduction to Digital Systems 1.2. Binary Numbers 1.3. Number Base Conversion 1.4. Octal and Hexadecimal.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Digital System Design. Objective Distinguish between Two worlds Understand the Properties digital system.
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.
CSE 101 Lesson - 1 Number System & Program Design Sonia corraya (SOC)
Fall’ 2014 Number System CSE Number System How Computers Represent Data Binary Numbers The Binary Number System Bits and Bytes Text Codes Binary.
EEE 301 : Digital ELECTRONICS Amina Hasan Abedin Senior lecturer, Dept of EEE, BRAC University.
CSE 260 Digital Logic Design Md. Shamsul Kaonain Khadija Rasul Aniqua Zereen.
1. Binary, Decimal, Hexadecimal and Octal. 2. Conversion between various number systems. Number Systems:
(Courtesy: Dr. Amitabha Chakrabarty) Lesson - 2 Number System & Program Design CSE 101.
Programming and Data Structure
Digital Design Chapter One Digital Systems and Binary Numbers
Number Systems and Codes
CHAPTER 1 : INTRODUCTION
Introduction to Chapter 2
Introduction The term digital is derived from the way computers perform operation, by counting digits. Application of digital technology: television, communication.
Number System conversions
Number Systems and Binary Arithmetic
Number Systems and Codes
Numbering System TODAY AND TOMORROW 11th Edition
How Computers Store Data
Chapter Four Data Representation in Computers By Bezawit E.
Transforming Data into Information
Presentation transcript:

Fall’ 2014 Lesson - 1 Number System & Program Design CSE 101

2 This Lesson Includes Following section Number System

3 How Computers Represent Data Binary Numbers The Binary Number System Bits and Bytes Text Codes Binary Number Computer processing is performed by transistors, which are switches with only two possible states: on and off. All computer data is converted to a series of binary numbers– 1 and 0. For example, you see a sentence as a collection of letters, but the computer sees each letter as a collection of 1s and 0s. If a transistor is assigned a value of 1, it is on. If it has a value of 0, it is off. A computer's transistors can be switched on and off millions of times each second.

4 Number System The Binary Number System To convert data into strings of numbers, computers use the binary number system. Humans use the decimal system (“deci” stands for “ten”). Elementory storage units inside computer are electronic switches. Each switch holds one of two states: on (1) or off (0). We use a bit (binary digit), 0 or 1, to represent the state. ON OFF 0 (00) 1 (01) 2 (10) 3 (11) The binary number system works the same way as the decimal system, but has only two available symbols (0 and 1) rather than ten (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9).

5 Number System Bits and Bytes A single unit of data is called a bit, having a value of 1 or 0. Computers work with collections of bits, grouping them to represent larger pieces of data, such as letters of the alphabet. Eight bits make up one byte. A byte is the amount of memory needed to store one alphanumeric character. With one byte, the computer can represent one of 256 different symbols or characters

6 Number System Text Codes A text code is a system that uses binary numbers (1s and 0s) to represent characters understood by humans (letters and numerals). An early text code system, called EBCDIC (Extended Binary Coded Decimal Interchange Code), uses eight-bit codes, but is used primarily in older mainframe systems. In the most common text-code set, ASCII (American Standard Code for Information Interchange), each character consists of eight bits (one byte) of data. ASCII is used in nearly all personal computers. In the Unicode text-code set, each character consists of 16 bits (two bytes) of data CodeCharacter A B C D E

7 Number System  In general, N bits can represent 2 N different values.  For M values, bits are needed. 1 bit  represents up to 2 values (0 or 1) 2 bits  rep. up to 4 values (00, 01, 10 or 11) 3 bits  rep. up to 8 values (000, 001, 010. …, 110, 111) 4 bits  rep. up to 16 values (0000, 0001, 0010, …, 1111) 32 values  requires 5 bits 64 values  requires 6 bits 1024 values  requires 10 bits 40 values  requires 6 bits 100 values  requires 7 bits  Decimal number system, symbols = { 0, 1, 2, 3, …, 9 }  Position is important  Example:(7594) 10 = (7x10 3 ) + (5x10 2 ) + (9x10 1 ) + (4x10 0 )  In general, (a n a n-1 … a 0 ) 10 = (a n x 10 n ) + (a n-1 x 10 n-1 ) + … + (a 0 x 10 0 )  (2.75) 10 = (2 x 10 0 ) + (7 x ) + (5 x )  In general, (a n a n-1 … a 0. f 1 f 2 … f m ) 10 = (a n x 10 n ) + (a n-1 x10 n-1 ) + … + (a 0 x 10 0 ) + (f 1 x ) + (f 2 x ) + … + (f m x 10 -m )

8 Other Number System  Binary (base 2): weights in powers-of-2. Binary digits (bits): 0,1.  Octal (base 8): weights in powers-of-8. Octal digits: 0,1,2,3,4,5,6,7  Hexadecimal (base 16): weights in powers-of-16. Hexadecimal digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F BinaryOctalDecimalHexadecimal A B C D E F

9 Number System – Base–R to Decimal Conversion  ( ) 2 = 1    2 -2 12 -3 = = (13.625) 10  (572.6) 8 = 5   8 -1 = = (378.75) 10  (2A.8) 16 = 2  16 -1 = = (42.5) 10  (341.24) 5 = 3    5 -2 = = (96.56) 10

10 Number System – Decimal to Binary Conversion  Method 1: Sum-of-Weights Method  Method 2:  Repeated Division-by-2 Method (for whole numbers)  Repeated Multiplication-by-2 Method (for fractions) Sum-of-Weights Method  Determine the set of binary weights whose sum is equal to the decimal number. (9) 10 = = = (1001) 2 (18) 10 = = = (10010) 2 (58) 10 = = = (111010) 2 (0.625) 10 = = = (0.101) 2

11 Number System – Decimal to Binary Conversion To convert a whole number to binary, use successive division by 2 until the quotient is 0. The remainders form the answer, with the first remainder as the least significant bit (LSB) and the last as the most significant bit (MSB). (43) 10 = (101011) 2 Repeated Multiplication-by-2 Method (for fractions) Repeated Division-by-2 Method (for whole number) To convert decimal fractions to binary, repeated multiplication by 2 is used, until the fractional product is 0 (or until the desired number of decimal places). The carried digits, or carries, produce the answer, with the first carry as the MSB, and the last as the LSB. (0.3125) 10 = (.0101) 2

12 Number System - Conversion between Decimal to other Base  Decimal to base-R  whole numbers: repeated division-by-R  fractions: repeated multiplication-by-R In general, conversion between bases can be done via decimal: Base-2Base-3 Base-4DecimalBase-4 … ….Base-R

13 Number System - Conversion between Decimal to other Base Octal and Hexadecimal Numbers The conversion of binary, octal and hexadecimal plays an important part in digital computers. Each octal digit corresponds to three digits and each hexadecimal digit corresponds to four binary digits. The conversion from binary to octal is easily accomplished by partitioning the binary number into groups of three each, starting from the binary point and proceeding to the left and to the right. Conversion from binary to hexadecimal is similar. Conversion from the octal or hexadecimal to binary is done by procedure reverse to the above.  Binary  Octal: Partition in groups of 3 ( ) 2 = ( ) 8  Octal  Binary: reverse ( ) 8 = ( ) 2  Binary  Hexadecimal: Partition in groups of 4 ( ) 2 = (5D9.B8) 16  Hexadecimal  Binary: reverse (5D9.B8) 16 = ( ) 2 Binary-Octal/Hexadecimal Conversion

14 Any Question Fall’12