GCSE COMPUTER SCIENCE Topic 3 - Data 3.2 Signed Integers.

Slides:



Advertisements
Similar presentations
GCSE Computing Theory © gcsecomputing.net 1 GCSE Computing 2.14 Data Representation Binary Arithmetic.
Advertisements

Chapter 4.2 Binary numbers: Arithmetic
Mathematics with Binary. Question  Below is a binary string  Which is the least significant bit (LSB)?  Which is the most significant bit (MSB)? 0.
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.
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
Chapter 4: Representation of data in computer systems: Number OCR Computing for GCSE © Hodder Education 2011.
07/12/ Data Representation Two’s Complement & Binary Arithmetic.
Addition and Substraction
GCSE Computing: A451 Computer Systems & Programming Numbers Representation of Data in Computer Systems.
Candidates should be able to:
A)Convert positive denary whole numbers (0-255) into 8-bit binary numbers and vice versa b)Add two 8-bit binary integers and explain overflow errors which.
GCSE Computing#BristolMet Session Objectives#8 MUST add two 8-bit binary integers SHOULD explain overflow errors COULD provide solutions to limit overflow.
2's Complement Arithmetic
Numerical formats What’s the main idea? Want to represent numbers (eg: 45, -12, ) using only bits. We’ve already seen (or you can read in the book)
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
Two’s Complement The language of machines, part II.
Starter Using the mini whiteboards record your answers: 1) Name 2 different Character Sets 2) Convert the Hex number 9E into denary 3) Convert the binary.
Advanced Binary b. describe and use two’s complement and sign and magnitude to represent negative integers; c. perform integer binary arithmetic, that.
Lecture 4: Digital Systems & Binary Numbers (4)
WHAT IS BINARY? Binary is a number system that only uses two digits: 1 and 0. Any information that processed by a computer it is put into sequence of.
Negative Number Sign-Magnitude: left-most bit as the sign bit –16 bits –Example: 4-bit numbers is given by is given by ’s complement:
Integer Addition and Subtraction. Integer Addition Rules Rule #1 – If the signs are the same, pretend the signs aren’t there. Add the numbers and then.
CHAPTER 5: Representing Numerical Data
Department of Computer Science Georgia State University
Binary -ve and +ve numbers!.
Negative numbers: Week 10 Lesson 1
2's Complement Arithmetic
Binary numbers: Week 7 Lesson 1
Computer Science 210 Computer Organization
Lesson objectives Understand how computers represent and manipulate numbers [unsigned integers, signed integers (sign and magnitude, Two’s complement)
CHAPTER 4: Representing Integer Data
Addition and Substraction
Binary Addition & Subtraction
Computer Science 210 Computer Organization
Teaching Computing to GCSE
Lesson Objectives To understand how to add 4 and 8 bit binary numbers together To understand what is meant by the term “Overflow” ALL students will add.
INTEGER RULES Positives & negatives.
Add Subtract Positive Negative integers
Topic 3: Data Signed Binary.
Data Representation in Computer Systems
CSC 143 Two' s complement.
2’s Complement Arithmetic
Teaching Computing to GCSE
Adding and Subtracting Integers
The Integer Song.
1.6) Storing Integer:.
Unit 18: Computational Thinking
C1 Number systems.
Lesson 1 Adding Integers.
1.3 and 1.4 Watch Your Signs!.
How are negative and rational numbers represented on the computer?
CPS120: Introduction to Computer Science
Binary  Name: Class: .
INTEGER RULES Positives & negatives.
GCSE COMPUTER SCIENCE Topic 3 - Data 3.4 Hexadecimal Conversion.
Binary It’s all 0’s and 1’s.
CSC 220: Computer Organization Signed Number Representation
Data Binary Arithmetic.
COMS 361 Computer Organization
Quick Review and Warm-Up You can copy for notes if needed.
Chapter3 Fixed Point Representation
Binary.
GCSE COMPUTER SCIENCE Topic 3 - Data 3.3 Logical and Arithmetic Shifts.
Theory: 2.6 – Data Representation
Add and Subtract Positive & Negative Integers
Subtracting integers without number line 3 digit.
Two’s Complement & Binary Arithmetic
Adding integers without number line 2 digit.
Presentation transcript:

GCSE COMPUTER SCIENCE Topic 3 - Data 3.2 Signed Integers

When we want to represent negative numbers, we used signed integers Reminder An integer is a whole number, it can have a positive or negative value

Convert this sign and magnitude number to denary: 1 1111 Negative Numbers: Sign and Magnitude This is the simplest method of representing negative numbers in binary. The most significant bit is the sign bit. 1 = minus 0 = plus Sign bit 128 64 32 16 8 4 2 1 +27 -27 ACTIVITY Convert this sign and magnitude number to denary: 1 1111

Activity Explain how to convert sign and magnitude numbers to denary. Question Answer Explain how to convert sign and magnitude numbers to denary. The left most bit is the sign bit. 0 represents a positive number and 1 represents a negative number. This bit does not count in the actual process of adding up the binary number.

Activity 1100 1101 -(64+8+4+1) = -77 0001 1111 +(16+8+4+2+1) = +31 Sign and magnitude binary number Denary 1100 1101 -(64+8+4+1) = -77 0001 1111 +(16+8+4+2+1) = +31 1100 0001 -(64+1) = -65 1111 1110 -(64+32+16+8+4+2) = -126 0111 1101 +(64+32+16+8+4+1) = +125 1011 1110 -(32+16+8+4+2) = -62 0101 1011 +(64+16+8+2+1) = +91

Convert this two’s complement binary number to denary: 11100011 Negative Numbers: Two’s Complement Two’s Complement is an alternative method of representing negative numbers. This method also works with binary addition. The most significant (the left most and largest number) bit is the minus number. -128 64 32 16 8 4 2 1 -128 + 8 + 4 + 1 = -115 ACTIVITY Convert this two’s complement binary number to denary: 11100011

Activity Question Answer Explain how to convert two’s complement numbers into denary The left most bit (the largest bit) represents the negative value of the usual number. For example in an 8-bit number it would be -128 instead of 128. It is then added up as usual.

Activity 1100 1101 -128+64+8+4+1 = -51 0001 1111 16+8+4+2+1 = 31 Two’s complement binary number Denary 128 64 32 16 8 4 2 1 1100 1101 -128+64+8+4+1 = -51 0001 1111 16+8+4+2+1 = 31 1000 1010 -128+8+2 = -118 0101 1100 64+16+8+4 = 92 1000 0000 -128 1111 1111 -128+64+32+16+8+4+2+1 = -1 0111 1110 64+32+16+8+4+2 = 126

Negative Number Issues The problem with sign and magnitude is that it does not always work when adding together numbers. 1 (+7) (-5) + (-12) Sign bit

Write these rules in your book and memorise them! Binary Addition The process of performing addition in binary is similar to addition in denary The Rules 0+0 = o 1+0 or 0+1 = 1 1+1 = 0 carry 1 1+1+1 = 1 carry 1 Write these rules in your book and memorise them! 1 + 1 + 1 + 1

If you do not show your working out you will not get any marks Activity Add these binary numbers, check your answer by converting them to denary. 1 + 1 + 1 + 1 + If you do not show your working out you will not get any marks 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 +

Overflow Errors When there isn’t enough room for a result, this is called an overflow and it produces an overflow error 1 + Copy this example and explanation of an overflow error in your book ACTIVITY No room for a carry, so it is lost and we get the wrong answer Humans can easily work around this, but it isn’t so easy for a computer