Download presentation
Presentation is loading. Please wait.
Published byColleen Conley Modified over 5 years ago
1
GCSE COMPUTER SCIENCE Topic 3 - Data 3.3 Logical and Arithmetic Shifts
2
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)
3
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
4
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
5
Binary Shifts: Logical
Direction Purpose Example 1 Left Multiply by 2 1010 (10) 10100 (20) = 2 Left Multiply by 4 1010 (10) (40) = 3 Left Multiply by 8 1010 (10) (80) =
6
Binary Shifts: Logical
Direction Purpose Example 1 Right Divide by 2 (40) (20) = 2 Right Divide by 4 (40) (10) = 3 Right Divide by 8 (40) (5) =
7
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) (40) = 1 Right Divide by 2 (40) (20) = 2 Right Divide by 4 (40) (10) = Copy these examples into your workbook
8
Activity Shift Direction Purpose Example Result 1 Left Multiply by 2
0101 (5) 01010 (10) = 2 Left Multiply by 4 1111 (15) (60) = 1 Right Divide by 2 (50) (25) = 2 Right Divide by 4 (80) (20) =
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.