GCSE COMPUTER SCIENCE Topic 3 - Data 3.3 Logical and Arithmetic Shifts.

Slides:



Advertisements
Similar presentations
Binary Addition Rules Adding Binary Numbers = = 1
Advertisements

CMP 101 Fundamentals of Computer and programming in C Rohit Khokher.
COE 308: Computer Architecture (T032) Dr. Marwan Abu-Amara Integer & Floating-Point Arithmetic (cont.) (Appendix A, Computer Architecture: A Quantitative.
Integer Arithmetic Floating Point Representation Floating Point Arithmetic Topics.
Quiz 1.1 Convert the following unsigned binary numbers to their decimal equivalent: Number2 Number
Mathematics with Binary. Question  Below is a binary string  Which is the least significant bit (LSB)?  Which is the most significant bit (MSB)? 0.
COE 308: Computer Architecture (T041) Dr. Marwan Abu-Amara Integer & Floating-Point Arithmetic (Appendix A, Computer Architecture: A Quantitative Approach,
They are the same as registers since they store binary numbers. Called shifting registers since they shift (left or right) the binary number stored in.
3. Representing Integer Data
© GCSE Computing Candidates should be able to:  convert positive denary whole numbers (0-255) into 8-bit binary numbers and vice versa  add two 8-bit.
© Janice Regan, CMPT 128, Jan CMPT 128: Introduction to Computing Science for Engineering Students Integer Data representation Addition and Multiplication.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To be able to use the bitwise logical operators in programs ❏ To be able to use.
– Digital Circuit 1 Choopan Rattanapoka
Introduction to Numerical Analysis I MATH/CMPSC 455 Binary Numbers.
Bitwise operators. Representing integers We typically think in terms of decimal (base 10) numbers.  Why?  A decimal (or base 10) number consists of.
Operations on Bits Arithmetic Operations Logic Operations
Bitwise operators. Representing integers We typically think in terms of decimal (base 10) numbers.  Why?  A decimal (or base 10) number consists of.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
Computer Organization 1 Data Representation Negative Integers.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
11001 / 101, / ) Perform subtraction on the given unsigned binary numbers using the 2's complement of the subtrahend. Where the result.
973cs111_add_posneg.ppt Integers Whole numbers Do NOT contain decimal points (as in money) 43,689 is an integer 43, is NOT an integer (it is floating.
DIGITAL Logic DESIGN Digital system and binary numbers Lecturer: Ms. Farwah Ahmad.
Binary & Hex Review.
David Kauchak CS 52 – Spring 2017
Dr.Faisal Alzyoud 2/20/2018 Binary Arithmetic.
Interesting Integers – Part Dos
Digital Logic & Design Adil Waheed Lecture 02.
Negative numbers: Week 10 Lesson 1
Chapter 4 Operations on Bits.
CHAPTER 9 COMPUTER ARITHMETIC - ALU
Recap Add these numbers together in binary
Digital Logic & Design Dr. Waseem Ikram Lecture 02.
Integer Real Numbers Character Boolean Memory Address CPU Data Types
11001 / 101 , / ) Perform subtraction on the given unsigned binary numbers using the 2's complement of the subtrahend. Where the.
1.11, 1.12, 1.13, 1.14, 1.18, 1.20, 1.23, 1.24, 1.25, 1.32, 1.33 ( 47 )8 = ( )2 ( 47 )16 = ( )2 ( 20 )10.
Computer Science 210 Computer Organization
CSE 102 Introduction to Computer Engineering
Lesson objectives Understand how computers represent and manipulate numbers [unsigned integers, signed integers (sign and magnitude, Two’s complement)
REALLY BIG & REALLY small Numbers
Number Systems.
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
Computer Science 210 Computer Organization
Teaching Computing to GCSE
Chapter 14 Bitwise Operators Objectives
Data Representation in Computer Systems
Digital Logic & Design Lecture 02.
Teaching Computing to GCSE
ECEG-3202 Computer Architecture and Organization
Unit 18: Computational Thinking
C1 Number systems.
Number Representation
Arithmetic Topics Basic operations Programming Implications
1-8 Multiplying and Dividing Integers
Homework Homework Continue Reading K&R Chapter 2 Questions?
CPS120: Introduction to Computer Science
Multiplying Integers SAME SIGNS??? Answer will be POSITIVE. ex)
Binary to Decimal Conversion
Percents and Decimals Objective:
CSC 220: Computer Organization Signed Number Representation
Binary & Hex Review.
GCSE COMPUTER SCIENCE Topic 3 - Data 3.2 Signed Integers.
Chapter3 Fixed Point Representation
OBJECTIVES After reading this chapter, the reader should be able to :
Multiplication and Division of Integers
靜夜思 床前明月光, 疑是地上霜。 舉頭望明月, 低頭思故鄉。 ~ 李白 李商隱.
Chapter 1 Introduction.
Divide two Integers.
Lecture 9: Shift, Mult, Div Fixed & Floating Point
Section 6 Primitive Data Types
Presentation transcript:

GCSE COMPUTER SCIENCE Topic 3 - Data 3.3 Logical and Arithmetic Shifts

Performed on unsigned integers (normal binary numbers) Binary Shifts A binary shift is an operation done to all bits of a binary number in which they are moved a set number of places either left or right Logical Shift Performed on unsigned integers (normal binary numbers) Arithmetic Shift Performed on signed integers (negative binary numbers using two’s complement)

Binary Shifts In denary (decimal) when we want to multiply a number by 10 we move each number one place to the left and add a 0 to the end (and vice versa for division) To multiply by 10 we move digits to the left and add a 0 To divide by 10 we move digits to the right and remove a 0 3 1 2 8 A left shift of 1 is used for multiplying by 10 A right shift of 1 is used for dividing by 10

Logical shifts allow you to multiply and divide binary numbers Binary Shifts: Logical Logical shifts allow you to multiply and divide binary numbers Because binary is a base-2 number system, left and right shifts can be used for multiplying and dividing by powers of 2

Binary Shifts: Logical Direction Purpose Example 1 Left Multiply by 2 1010 (10) 10100 (20) = 2 Left Multiply by 4 1010 (10) 101000 (40) = 3 Left Multiply by 8 1010 (10) 1010000 (80) = 128 64 32 16 8 4 2 1

Binary Shifts: Logical Direction Purpose Example 1 Right Divide by 2 101000 (40) 101000 (20) = 2 Right Divide by 4 101000 (40) 101000 (10) = 3 Right Divide by 8 101000 (40) 101000 (5) = 128 64 32 16 8 4 2 1

Copy these examples into your workbook Binary Shifts: Logical Shift Direction Purpose Example 1 Left Multiply by 2 1010 (10) 10100 (20) = 2 Left Multiply by 4 1010 (10) 101000 (40) = 1 Right Divide by 2 101000 (40) 101000 (20) = 2 Right Divide by 4 101000 (40) 101000 (10) = Copy these examples into your workbook

Activity Shift Direction Purpose Example Result 1 Left Multiply by 2 0101 (5) 01010 (10) = 2 Left Multiply by 4 1111 (15) 111100 (60) = 1 Right Divide by 2 110010 (50) 110010 (25) = 2 Right Divide by 4 1010000 (80) 1010000 (20) = 128 64 32 16 8 4 2 1