Computer Science 101 Binary Systems. Humans Decimal Numbers (base 10) Decimal Numbers (base 10) Sign-Magnitude (-324) Sign-Magnitude (-324) Decimal Fractions.

Slides:



Advertisements
Similar presentations
Number Systems and Codes
Advertisements

A-Level Computing#BristolMet Session Objectives#9 express numbers in binary, binary-coded decimal (BCD), octal and hexadecimal; describe and use two’s.
DATA REPRESENTATION CONVERSION.
Binary Systems1 DIGITAL LOGIC DESIGN by Dr. Fenghui Yao Tennessee State University Department of Computer Science Nashville, TN.
Binary Representation Introduction to Computer Science and Programming I Chris Schmidt.
Representations Example: Numbers –145 –CVL – –91 –
Chapter Chapter Goals Know the different types of numbers Describe positional notation.
Data Representation in Computers
Number System Conversions Lecture L2.2 Section 2.3.
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA, Dc. Sc. & Engg.
Computer Science 210 Computer Organization Floating Point Representation.
Number Systems and Arithmetic
Computer Fluency Binary Systems. Humans Decimal Numbers (base 10) Decimal Numbers (base 10) Sign-Magnitude (-324) Sign-Magnitude (-324) Decimal Fractions.
Data Storage. SIGN AND MAGNITUDE Storing and representing numbers.
Computer Science 101 Number Systems. Humans Decimal Numbers (base 10) Decimal Numbers (base 10) Sign-Magnitude (-324) Sign-Magnitude (-324) Decimal Fractions.
Number Systems Computer Science 210 Computer Organization.
+ CS 325: CS Hardware and Software Organization and Architecture Integers and Arithmetic.
EKT 121 / 4 ELEKTRONIK DIGIT 1 CHAPTER 1 : INTRODUCTION.
Based on slides by:Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. ECE/CS 352: Digital System Fundamentals Lecture 1 – Number Systems and.
Computer Science 111 Fundamentals of Programming I Number Systems.
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
COMPSCI 210 Semester Tutorial 1
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
Data Representation Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
The Teacher CP4 Binary and all that… CP4 Revision.
Number systems, Operations, and Codes
Positional Number Systems
Positional Notation 642 in base 10 positional notation is:
Lecture 2 Binary Values and Number Systems. The number 943 is an example of a number written in positional notation. The relative positions of the digits.
The Teacher CP4 Binary and all that… CP4 Revision.
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 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
Chapter 1  Number Systems Decimal System Binary System Octal System Hexadecimal System  Binary weighted cods Signed number binary order  1’s and 2’s.
CDP ECE Spring 2000 ECE 291 Spring 2000 Lecture 2: Number Systems & x86 Instructions Constantine D. Polychronopoulos Professor, ECE Office: 463.
Data as the computer sees it 1.  Number systems Number systems  Data storage Data storage  Glossary Glossary 2.
CEC 220 Digital Circuit Design Number Systems & Conversions Friday, January 9 CEC 220 Digital Circuit Design Slide 1 of 16.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
CPSC 171 Introduction to Computer Science Binary.
Number System Base b Use only digits of 0, 1, 2,…., b-1 Positional weights X = a n-1 b n-1 + a n-2 b n-2 + …. + a 0 b = 1x x10 1 +
CEC 220 Digital Circuit Design Number Systems & Conversions Wednesday, Aug 26 CEC 220 Digital Circuit Design Slide 1 of 16.
Computer Studies Today Chapter 19 1 Chapter 19. Computer Studies Today Chapter 19 2 »Information stored in a computer is in two states: –ON –OFF.
Lecture 1.2 (Chapter 1) Prepared by Dr. Lamiaa Elshenawy
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
The Hexadecimal System is base 16. It is a shorthand method for representing the 8-bit bytes that are stored in the computer system. This system was chosen.
Number Systems and Binary Arithmetic Quantitative Analysis II Professor Bob Orr.
Fall’ 2014 Lesson - 1 Number System & Program Design CSE 101.
Chapter 32 Binary Number System. Objectives After completing this chapter, you will be able to: –Describe the binary number system –Identify the place.
Binary a. express numbers in binary, binary-coded decimal (BCD), octal and hexadecimal;
Fall’ 2014 Number System CSE Number System How Computers Represent Data Binary Numbers The Binary Number System Bits and Bytes Text Codes Binary.
Binary Values. Numbers Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative Numbers.
Some basic concepts underlying computer archi­tecture
Computer Science 210 Computer Organization
Digital Design Chapter One Digital Systems and Binary Numbers
Number Systems and Codes
Computer Science 210 Computer Organization
Number Systems and Binary Arithmetic
Digital Electronics INTRODUCTION ANALOG VS DIGITAL NUMBER SYSTEMS.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
CHAPTER 1 : INTRODUCTION
CSE 102 Introduction to Computer Engineering
University of Gujrat Department of Computer Science
Number Systems and Binary Arithmetic
Computer Science 210 Computer Organization
Numbering System TODAY AND TOMORROW 11th Edition
Computer Science 210 Computer Organization
How Computers Store Data
Information Representation
Presentation transcript:

Computer Science 101 Binary Systems

Humans Decimal Numbers (base 10) Decimal Numbers (base 10) Sign-Magnitude (-324) Sign-Magnitude (-324) Decimal Fractions (23.27) Decimal Fractions (23.27) Letters for text Letters for text

Computers Binary Numbers (base 2) Binary Numbers (base 2) Two’s complement and sign-magnitude Two’s complement and sign-magnitude Binary fractions and floating point Binary fractions and floating point ASCII codes for characters (A  65) ASCII codes for characters (A  65)

Why binary? Information is stored in computer via voltage levels. Information is stored in computer via voltage levels. Using decimal would require 10 distinct and reliable levels for each digit. Using decimal would require 10 distinct and reliable levels for each digit. This is not feasible with reasonable reliability and financial constraints. This is not feasible with reasonable reliability and financial constraints. Everything in computer is stored using binary: numbers, text, programs, pictures, sounds, videos,... Everything in computer is stored using binary: numbers, text, programs, pictures, sounds, videos,...

How can that be? Everything in computer is stored using binary: numbers, text, programs, pictures, sounds, videos,... Everything in computer is stored using binary: numbers, text, programs, pictures, sounds, videos,...

Transistor A transistor is an electronic switch A transistor is an electronic switch Basic unit of modern computer storage Basic unit of modern computer storage Two steady states based on voltage levels Two steady states based on voltage levels Say, 500 million transistors on a chip 1 cm 2 Say, 500 million transistors on a chip 1 cm 2 Change states in billionth of sec Change states in billionth of sec Solid state Solid state

Morse Code Morse Code

Morse Code Tree

Decimal: Non-negatives Base 10 Base 10 Uses decimal digits: 0,1,2,3,4,5,6,7,8,9 Uses decimal digits: 0,1,2,3,4,5,6,7,8,9 Positional System - position gives power of the base Positional System - position gives power of the base Example: 3845 = 3x x x x10 0 Example: 3845 = 3x x x x10 0 Positions: … Positions: …543210

Binary: Non-negatives Base 2 Base 2 Uses binary digits (bits): 0,1 Uses binary digits (bits): 0,1 Positional system Positional system Example: 1101 = 1x x x x2 0 Example: 1101 = 1x x x x2 0

Conversions ExternalInternal (Human) (Computer) A ExternalInternal (Human) (Computer) A Humans want to see and enter numbers in decimal. Humans want to see and enter numbers in decimal. Computers must store and compute with bits. Computers must store and compute with bits.

Binary to Decimal Conversion Algorithm: Algorithm: Expand binary number using positional scheme.Expand binary number using positional scheme. Perform computation using decimal arithmetic.Perform computation using decimal arithmetic. Example:  1x x x x x2 0 = = = Example:  1x x x x x2 0 = = = 25 10

Decimal to Binary - Algorithm 1 Algorithm: While N  0 do Set N to N/2 (whole part) Record the remainder (1 or 0) end-of-loop Set A to remainders in reverse order Algorithm: While N  0 do Set N to N/2 (whole part) Record the remainder (1 or 0) end-of-loop Set A to remainders in reverse order

Decimal to binary - Example Example: Convert to binary N Rem N Rem Example: Convert to binary N Rem N Rem = =

Decimal to Binary - Algorithm 2 Algorithm: Set A to 0 (all bits 0) While N  0 do Find largest P with 2 P  N Set bit in position P of A to 1 Set N to N - 2 P end-of-loop Algorithm: Set A to 0 (all bits 0) While N  0 do Find largest P with 2 P  N Set bit in position P of A to 1 Set N to N - 2 P end-of-loop

Decimal to binary - Example Example: Convert to binary N Power P A Example: Convert to binary N Power P A = =

Binary Addition One bit numbers: | | 1 10 One bit numbers: | | 1 10 Example (53) (45) (98) Example (53) (45) (98)

Octal Numbers Base 8 Digits 0,1,2,3,4,5,6,7 Base 8 Digits 0,1,2,3,4,5,6,7 Number does not have so many digits as binary Number does not have so many digits as binary Easy to convert to and from binary Easy to convert to and from binary Often used by people who need to see the internal representation of data, programs, etc. Often used by people who need to see the internal representation of data, programs, etc.

Octal Conversions Octal to Binary Octal to Binary Simply convert each octal digit to a three bit binary number. Simply convert each octal digit to a three bit binary number. Example: = Example: = Binary to Octal Binary to Octal Starting at right, group into 3 bit sections Starting at right, group into 3 bit sections Convert each group to an octal digit Convert each group to an octal digit Example = = Example = =

Hexadecimal Base 16 Digits 0,…,9,A,B,C,D,E,F Base 16 Digits 0,…,9,A,B,C,D,E,F Hexadecimal  Binary Hexadecimal  Binary Just like Octal, only use 4 bits per digit. Just like Octal, only use 4 bits per digit. Example: 98C3 16 = Example: 98C3 16 = Example = = 34EB Example = = 34EB

Python example