The Binary Number System

Slides:



Advertisements
Similar presentations
John Owen, Rockport Fulton HS
Advertisements

Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, C++ Version, Third Edition.
Chapter Chapter Goals Know the different types of numbers Describe positional notation.
Binary Conversion In today’s lesson we will link together the binary and algorithm topics by looking at how to get the computer to: convert binary to decimal.
Computer Systems Nat 4/5 Computing Science Lesson 1: Binary.
Binary Arithmetic Math For Computers.
Binary and Hexadecimal Numbers
1 Survey of Computer Science CSCI 110, Spring 2011 Lecture 16 Digital Circuits, binary Numbers.
(2.1) Fundamentals  Terms for magnitudes – logarithms and logarithmic graphs  Digital representations – Binary numbers – Text – Analog information 
Newport Math Club Copyright © 2009 by Newport Math Club.
Chapter 1 Basic Principles of Digital Systems. 2 Analog vs. Digital Analog: –A way of representing a physical quantity by a proportional continuous voltage.
CS105 INTRODUCTION TO COMPUTER CONCEPTS BINARY VALUES & NUMBER SYSTEMS Instructor: Cuong (Charlie) Pham.
MATH 224 – Discrete Mathematics
Numeral Systems Subjects: Numeral System Positional systems Decimal
EKT 121 / 4 ELEKTRONIK DIGIT 1 CHAPTER 1 : INTRODUCTION.
Numbering Systems CS208.
Operations With Decimals
Foundations of Computer Science Computing …it is all about Data Representation, Storage, Processing, and Communication of Data 10/4/20151CS 112 – Foundations.
Copyright 2005 Curt Hill Binary, Octal and Hexadecimal The number bases used in computers.
Chapter 2 Binary Values and Number Systems. 2 2 Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645,
Chapter 2: The Logic of Compound Statements 2.5 Application: Number Systems and Circuits for Addition 1 Counting in binary is just like counting in decimal.
Binary Values and Number Systems
CMSC 104, Lecture 051 Binary / Hex Binary and Hex The number systems of Computer Science.
Positional Notation 642 in base 10 positional notation is:
Data Representation Bits, Bytes, Binary, Hexadecimal.
1 Computer Science LESSON 1 on Number Bases. 2 Objective In this lesson you’ll learn about different Number Bases, specifically about those used by the.
Binary01.ppt Decimal Decimal: Base 10 means 10 Unique numerical digits ,00010,000 Weight Positions 3,
1 Ethics of Computing MONT 113G, Spring 2012 Session 1 Digital Circuits, binary Numbers Course webpage:
Phys 4330 Digital ElectronicsBinary System Digital circuits process signals that contain just two voltage levels or states, labeled logic "0" and logic.
Computer Systems Nat 4/5 Computing Science Lesson 1: Binary.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Information Representation: Positive Integers Dale Roberts,
Number Systems – Definitions page 214 The radix or base 밑 refers to the number b in an expression of the form b n. The number n is called the exponent.
Computer Science 4 On and OFF. Homework What have we created.
More Digital Representation Discrete information is represented in binary (PandA), and “continuous” information is made discrete.
Numbering Systems and Conversion Understand How Computing Devices Work 1.
Number Systems and Binary Arithmetic Quantitative Analysis II Professor Bob Orr.
Computer Maintenance Numbering Systems Copyright © Texas Education Agency, All rights reserved.1.
Number Systems Decimal Can you write 12,045 in expanded form? Base? Allowable digits for each place?
Prepared By: Norakmar Binti Mohd Nadzari CHAPTER 2 ARITHMETIC AND LOGIC UNIT.
Number Systems & Binary Arithmetic
3 – Boolean Logic and Logic Gates 4 – Binary Numbers
Invitation to Computer Science, C++ Version, Fourth Edition
Binary and Logic Computers use electrical signals that are on or off, so they have to see everything as a series of binary numbers. This data is represented.
Computer Maintenance Numbering Systems Trade & Industrial Education
Digital Design Chapter One Digital Systems and Binary Numbers
2's Complement Arithmetic
Number Systems and Binary Arithmetic
CMSC201 Computer Science I for Majors Lecture 22 – Binary (and More)
Digital Electronics INTRODUCTION ANALOG VS DIGITAL NUMBER SYSTEMS.
CHAPTER 1 : INTRODUCTION
COMPUTING FUNDAMENTALS
Computer Science LESSON 1 on Number Bases.
Tools of Web Development 1: Module A: Numbering Systems
Number System conversions
Number Systems.
Fundamentals & Ethics of Information Systems IS 201
Number Systems and Binary Arithmetic
Lesson 2 Programming constructs – Algorithms – Scratch – Variables Intro.
2’s Complement Arithmetic
Digital Electronics and Microprocessors
Chapter 2: Number Systems
Objective - To add and subtract decimals.
Objective 1.02 Understand Numbering Systems
AP Computer Science LESSON 1 on Number Bases.
John Owen, Rockport Fulton HS
Converting from Base-n to Base-10
GCSE COMPUTER SCIENCE Topic 3 - Data 3.1 Binary.
Binary, Hexadecimal, and Base 10.
This material is based upon work supported by the National Science Foundation under Grant #XXXXXX. Any opinions, findings, and conclusions or recommendations.
Presentation transcript:

The Binary Number System Acknowledgment and Disclaimer: This presentation is supported in part by the National Science Foundation under Grants 1240841, 1225680, 1225719, 1225745, 1225976, and 1226216. Any opinions, findings, and conclusions or recommendations expressed in these materials are those of the authors and do not necessarily reflect the views of the National Science Foundation. *

Important CS Principle Binary sequences -- sequences of 0s and 1s -- are used to represent all computer data. Numbers Letters and text. Images. Machine language instructions. Sounds and video. Every kind of data you find on a computer.

Binary vs. Decimal System Binary system is similar to the decimal system. Both are positional number systems. 542 is 500 + 40 + 2. Decimal is a base-10 system. 10 digits, 0 through 9 Place values are powers of 10 1s, 10s, 100s, 1000s, etc. Each place is previous place times 10

Binary vs. Decimal System Binary system is similar to the decimal system. Both are positional number systems. 101 is 4 + 0 + 1 = 5 Binary is a base-2 system. 2 digits, 0 through 1 Place values are powers of 2 1s, 2s, 4s, 8s, 16s, etc. Each place is previous place times 2

Why Do Computers Use Binary? In an electronic circuit, it’s easy to represent the difference between a switch being “on” or “off” or a voltage being “high” or “low”. It’s hard to represent 10 distinct states: “really high voltage”, “pretty high”, …, “pretty low”, “really low”.

Amazing Fact By combining 0s and 1s in various combinations we can represent any and all the data that computers use and process!

Converting Binary to Decimal (not hard!) *

Converting Binary to Decimal Here’s a simple algorithm for converting a binary number into its decimal equivalent. Convert binary 10101 to decimal

Converting Binary to Decimal Step 1. Write the binary number with some spaces between its digits. Convert binary 10101 to decimal 1. Write the number with spaces between the digits. 1 0 1 0 1

Converting Binary to Decimal Step 2. Write the binary place values above the number, going right to left: 1s, 2s, 4s, 8s, etc. Convert binary 10101 to decimal 1. Write the number with spaces between the digits. 1 0 1 0 1 2. Write the binary place values above the number, going right to left. 16 8 4 2 1 1 0 1 0 1

Converting Binary to Decimal Step 3. Add up the place values that have a 1 beneath them. Convert binary 10101 to decimal 1. Write the number with spaces between the digits. 1 0 1 0 1 2. Write the binary place values above the number, going right to left. 16 8 4 2 1 1 0 1 0 1 3. Add up all the place values that have a 1 underneath them. 16 + 4 + 1 = 21

Converting Binary to Decimal Step 4. The result, the sum, is the decimal value of the original binary number. Convert binary 10101 to decimal 1. Write the number with spaces between the digits. 1 0 1 0 1 2. Write the binary place values above the number, going right to left. 16 8 4 2 1 1 0 1 0 1 3. Add up all the place values that have a 1 underneath them. 16 + 4 + 1 = 21 4. The result is the decimal value of the binary number 21

Converting Decimal to Binary (not hard!) *

Converting Decimal to Binary Here’s an algorithm for going in the opposite direction, converting a decimal number into binary. Let D be the number we want to convert to binary. Suppose D = 25

Converting Decimal to Binary Step 1: Write down D and the binary place values, 1, 2, 4, 8, 16, and so. And put 0s under each place. Let D be the number we want to convert to binary. Suppose D = 25 1. Write down D and next to it the binary place values with spaces between them with 0s below each place. D = 25 32 16 8 4 2 1 0 0 0 0 0 0

Converting Decimal to Binary Step 2: Find the largest place value that is less than or equal to D and change its 0 to 1. Let D be the number we want to convert to binary. Suppose D = 25 1. Write down D and next to it the binary place values with spaces between them with 0s below each place. D = 25 32 16 8 4 2 1 0 0 0 0 0 0 2. Find the largest place value that is less than or equal to D and change its 0 to a 1. D = 25 32 16 8 4 2 1 0 1 0 0 0 0

Converting Decimal to Binary Step 3. Subtract that place value from D and take the result as the new value of D. Let D be the number we want to convert to binary. Suppose D = 25 1. Write down D and next to it the binary place values with spaces between them with 0s below each place. D = 25 32 16 8 4 2 1 0 0 0 0 0 0 2. Find the largest place value that is less than or equal to D and change its 0 to a 1. D = 25 32 16 8 4 2 1 0 1 0 0 0 0 3. Subtract that place value from D and take the result as a new value for D. D = 9 32 16 8 4 2 1 0 1 0 0 0 0

Converting Decimal to Binary Step 4: Repeat steps 2 and 3 until D is 0. Let D be the number we want to convert to binary. Suppose D = 25 1. Write down D and next to it the binary place values with spaces between them with 0s below each place. D = 25 32 16 8 4 2 1 0 0 0 0 0 0 2. Find the largest place value that is less than or equal to D and change its 0 to a 1. D = 25 32 16 8 4 2 1 0 1 0 0 0 0 3. Subtract that place value from D and take the result as a new value for D. D = 9 32 16 8 4 2 1 0 1 0 0 0 0 4. Repeat steps 2 and 3 with the new value of D until D is 0. D = 1 32 16 8 4 2 1 0 1 1 0 0 0

Converting Decimal to Binary Step 4 (again): Repeat steps 2 and 3 until D becomes 0. Let D be the number we want to convert to binary. Suppose D = 25 1. Write down D and next to it the binary place values with spaces between them with 0s below each place. D = 25 32 16 8 4 2 1 0 0 0 0 0 0 2. Find the largest place value that is less than or equal to D and change its 0 to a 1. D = 25 32 16 8 4 2 1 0 1 0 0 0 0 3. Subtract that place value from D and take the result as a new value for D. D = 9 32 16 8 4 2 1 0 1 0 0 0 0 4. Repeat steps 2 and 3 with the new value of D until D is 0. D = 1 32 16 8 4 2 1 0 1 1 0 0 0 D = 0 32 16 8 4 2 1 0 1 1 0 0 1

Converting Decimal to Binary Step 5: Now that D is 0 we stop. The value of 25 in decimal is 11001 (we drop the leading 0s). Let D be the number we want to convert to binary. Suppose D = 25 1. Write down D and next to it the binary place values with spaces between them with 0s below each place. D = 25 32 16 8 4 2 1 0 0 0 0 0 0 2. Find the largest place value that is less than or equal to D and change its 0 to a 1. D = 25 32 16 8 4 2 1 0 1 0 0 0 0 3. Subtract that place value from D and take the result as a new value for D. D = 9 32 16 8 4 2 1 0 1 0 0 0 0 4. Repeat steps 2 and 3 with the new value of D until D is 0. D = 1 32 16 8 4 2 1 0 1 1 0 0 0 D = 0 32 16 8 4 2 1 0 1 1 0 0 1 5. The resulting number is the binary equivalent of the original value of D. 25 in decimal is 11001.