Lesson objectives Understand how computers represent and manipulate numbers [unsigned integers, signed integers (sign and magnitude, Two’s complement)

Slides:



Advertisements
Similar presentations
Candidates should be able to:
Advertisements

CS 151 Digital Systems Design Lecture 3 More Number Systems.
Representations Example: Numbers –145 –CVL – –91 –
Mathematics with Binary. Question  Below is a binary string  Which is the least significant bit (LSB)?  Which is the most significant bit (MSB)? 0.
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
Binary numbers. 1 Humans count using decimal numbers (base 10) We use 10 units: 0, 1, 2, 3, 4, 5, 6, 7, 8 and (5.
© 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.
Binary Representation - Shortcuts n Negation x + x = 1111…1111 two = -1 (in 2’s complement) Therefore, -x = x + 1 n Sign Extension o Positive numbers :
A-Level Computing Data representation. Objectives Know how data can be represented in a computer system Understand the need for various forms of representation.
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 1 Today’s Topics How information.
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.
Conversions Denary to Binary Method 1
Hexadecimal Data Representation. Objectives  Know how the Hexadecimal counting system works  Be able to convert between denary, binary & hexadecimal.
Candidates should be able to:
CS1Q Computer Systems Lecture 2 Simon Gay. Lecture 2CS1Q Computer Systems - Simon Gay2 Binary Numbers We’ll look at some details of the representation.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
Reasons to  Binary With Mrs
Computer Organization 1 Data Representation Negative Integers.
Hexadecimal (base 16) BY MAT D. What is hexadecimal  Hexadecimal is a number system like binary or denary that has 16 characters, the numbers 0-9 and.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
Two’s Complement The language of machines, part II.
STARTER – CRACK THE CODE
Conversions 1)Binary to Denary Method 1 Work out the position values of the binary bits and add those values together So above would be
Software Design and Development Storing Data Computing Science.
11001 / 101, / ) Perform subtraction on the given unsigned binary numbers using the 2's complement of the subtrahend. Where the result.
© 2016 AQA. Created by Teachit for AQA Converting between number bases Lesson.
ECE 2110: Introduction to Digital Systems Signed Number Conversions.
Lesson Objectives Aims You should know about: Binary numbers ‘n’ that.
Nat 4/5 Computing Science Lesson 1: Binary
Topic: Binary Encoding – Part 2
Design of Digital Circuits Reading: Binary Numbers
Binary, Denary, Hexadecimal Conversion Binary Addition
Binary -ve and +ve numbers!.
Negative numbers: Week 10 Lesson 1
Negative Binary Numbers
Recap Add these numbers together in binary
Lesson Objectives Aims
Binary numbers: Week 7 Lesson 1
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
Numbers in a Computer Unsigned integers Signed magnitude
Lesson Objectives Understand the hexadecimal numbering system
Data Representation Integers
Negative Binary Numbers
CSE 102 Introduction to Computer Engineering
Number Systems.
Lesson Objectives Aims You should be able to: Convert Denary to Binary
Computer Science 210 Computer Organization
Teaching Computing to GCSE
Topic 3: Data Signed Binary.
Data Representation in Computer Systems
Hexadecimal Conversions
Scientific Notation.
2’s Complement Arithmetic
Teaching Computing to GCSE
Topic 3: Data Hexadecimal.
Unit 18: Computational Thinking
COMS 161 Introduction to Computing
CS 101 – Sept. 4 Number representation Integer Unsigned √ Signed √
Number Representation
A-level Computer Science
GCSE COMPUTER SCIENCE Topic 3 - Data 3.4 Hexadecimal Conversion.
Numbers and Arithmetic and Logical Operation
Data Binary Arithmetic.
GCSE COMPUTER SCIENCE Topic 3 - Data 3.2 Signed Integers.
GCSE COMPUTER SCIENCE Topic 3 - Data 3.3 Logical and Arithmetic Shifts.
Two’s Complement & Binary Arithmetic
Section 6 Primitive Data Types
Presentation transcript:

Lesson objectives 3.1.2 Understand how computers represent and manipulate numbers [unsigned integers, signed integers (sign and magnitude, Two’s complement) real numbers] 3.1.5 Understand why hexadecimal notation is used and be able to convert between hexadecimal and binary and vice versa All students will be able to convert between hexadecimal / binary / denary All students will understand the term signed and unsigned integers Most students will be able to explain sign and magnitude Most students will be able to use Two’s compliment to represent positive and negative numbers.

Hexadecimal Computers use the binary system to operate. However, it is possible to make mistakes using long lists of binary numbers... Dec 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Hex A B C D E F

1. Base 10 to Base 16 Basic method Example: 60 in binary is 111100 Turn to Hexadecimal: 60 / 16 = 3 Remainder = 12 12 = C So: 60 = 3C Put these into Base 16: a) 76 b) 160 c) 65 d) 120 Make sure you add the working out... 76 = 4C 160 = 60 65 = 41 120 = 78

2. Base 16 to Base 10 a) 2F b) 6C c) 1E d) 3A Basic method Example: 7D in binary is 1111101 Turn to decimal: 7 * 16 = 112 D = 13 So: 7D = 112 + 13 7D = 125 Put these into Base 10: a) 2F b) 6C c) 1E d) 3A Make sure you add the working out... 2F = 47 6C = 108 1E = 30 3A = 58

or 3. Base 2 to Base 16 =3B Convert a) 00101010 b) 01001100 Basic method 1 Example: Turn base 2 to base 10 then to base 16 Basic method 2 Example: Split it in half or 1 1 1 Convert a) 00101010 b) 01001100 c) 10000001 2A 4C 81 What is this? (48) = 3 What is this? (11) = B =3B

or 4. Base 16 to Base 2 Convert a) 4F b) 2A c) 3C 1 1 1 Basic method 1 Example: Turn base 16 to base 10 then to base 2 Basic method 2 Example: 2F Split it in half or What is 2 in binary? (32) What is F in binary? (15) Convert a) 4F b) 2A c) 3C 4F = 1001111 2A = 0101010 3C = 0111100 1 1 1

Happy or sad?

All the binary numbers that we have used so far have been positive numbers.

Signed or unsigned Keyword check A signed integer – a number that could be positive or negative An unsigned integer – a number that is 0 or positive

Keyword check 1 – easy way to remember Signed Unsigned +sign or -sign Doesn’t need a sign!

Let’s take a trip To la la land

So what about: Negative numbers?

10001101 00000111 0 = positive Sign and Magnitude 1 = negative The most significant bit. 1 = negative What does this represent? The most significant bit. 0 = positive What does this represent? 1 = negative, 0 = positive

Some issues with sign and magnitude Both 1000 0000 and 0000 0000 represent 0. It wastes one binary code. 10001101 00000111 The most significant bit. 1 = negative What does this represent? The most significant bit. 0 = positive What does this represent? 1 = negative, 0 = positive

Method 1

Two’s compliment to denary 1111 1011 1 = negative, 0 = positive Step 1 note that the number is positive or negative:

Two’s compliment to denary 1111 1011 1 = negative, 0 = positive Step 2 locate the first 1

Two’s compliment to denary 1111 1011 00000101 1 = negative, 0 = positive Step 3 flip all the bits to the left of it

Two’s compliment to denary 00000101 =5 1 = negative, 0 = positive Step 4 we can work out the number now

Two’s compliment to denary 00000101 Don’t forget the sign = -5 Other examples: More complex = 1111 1100 = -4 11111111 = -1 Step 5 don’t forget the sign

Method 2

Two’s compliment to denary -128 1111 1011 1 = negative, 0 = positive Step 1 apply a sign to this number

Two’s compliment to denary -128 1111 1011 1 = negative, 0 = positive Step 2 then add all numbers to the right

Two’s compliment to denary -128+64+32+16+8+2+1 1111 1011 1 = negative, 0 = positive Step 2 then add all numbers to the right

Two’s compliment to denary = -5 1111 1011 http://en.wikibooks.org/wiki/A-level_Computing/AQA/Problem_Solving,_Programming,_Data_Representation_and_Practical_Exercise/Fundamentals_of_Data_Representation/Two's_complement Step 2 then add all numbers to the right