Extending Binary In today’s lesson we will look at: representing different types of numbers possible errors binary coded decimal (BCD) comparing BCD with.

Slides:



Advertisements
Similar presentations
A-Level Computing#BristolMet Session Objectives#9 express numbers in binary, binary-coded decimal (BCD), octal and hexadecimal; describe and use two’s.
Advertisements

Hexadecimal In today’s lesson we will look at: the need for something other than binary how hexadecimal works how to convert between hexadecimal and binary.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Assembly Language and Computer Architecture Using C++ and Java
Kavita Hatwal Fall The decimal system, also called the base 10 number system is based on ten numbers: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. All the numbers.
Number Systems Standard positional representation of numbers:
1 Lecture 3 Bit Operations Floating Point – 32 bits or 64 bits 1.
Signed Numbers.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Binary Numbers 1.Binary and Denary RecapBinary.
COMP201 Computer Systems Number Representation. Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter.
Topic 4 Computer Mathematics and Logic
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
© 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 and Computer Arithmetic
Introduction to Computing Systems from bits & gates to C & beyond Chapter 2 Bits, Data Types & Operations Integer Representation Floating-point Representation.
The Binary Number System
Simple Data Type Representation and conversion of numbers
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
IT 251 Computer Organization and Architecture Introduction to Floating Point Numbers Chia-Chi Teng.
Data Representation – Binary Numbers
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
Information Representation (Level ISA3) Floating point numbers.
Computer Arithmetic Nizamettin AYDIN
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
IT253: Computer Organization
Number Systems So far we have studied the following integer number systems in computer Unsigned numbers Sign/magnitude numbers Two’s complement numbers.
Computing Systems Basic arithmetic for computers.
Floating Point (a brief look) We need a way to represent –numbers with fractions, e.g., –very small numbers, e.g., –very large numbers,
Computer Science Engineering B.E.(4 th sem) c omputer system organization Topic-Floating and decimal arithmetic S ubmitted to– Prof. Shweta Agrawal Submitted.
Binary Arithmetic In today’s lesson we will look at: a reminder of how binary works adding binary numbers overflow complements negative numbers and subtraction.
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Computer Systems Architecture Copyright © Genetic Computer School 2008 CSA 1- 0 Lesson 1 Number System.
Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.
Data Representation Conversion 24/04/2017.
Fractions in Binary.
How a Computer Processes Information. Java – Numbering Systems OBJECTIVE - Introduction to Numbering Systems and their relation to Computer Problems Review.
AEEE2031 Data Representation and Numbering Systems.
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
07/12/ Data Representation Two’s Complement & Binary Arithmetic.
Introduction to Microprocessors Chapter 2. Decimal or Base 10 Numbers  Have ten different digits (0-9)  It is a weighted number system. Each position.
Number Systems Denary Base 10 Binary Base 2 Hexadecimal Base 16
CS1Q Computer Systems Lecture 2 Simon Gay. Lecture 2CS1Q Computer Systems - Simon Gay2 Binary Numbers We’ll look at some details of the representation.
Floating Point Binary A2 Computing OCR Module 2509.
CS 160 Lecture 4 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
Data Representation. How is data stored on a computer? Registers, main memory, etc. consists of grids of transistors Transistors are in one of two states,
©Brooks/Cole, 2003 Chapter 3 Number Representation.
10/7/2004Comp 120 Fall October 7 Read 5.1 through 5.3 Register! Questions? Chapter 4 – Floating Point.
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
Binary & Normalization What is Normalization? We discussed this the other day (special review session slides, near the end) Can someone tell us.
Two’s Complement The language of machines, part II.
Software Design and Development Storing Data Computing Science.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
Starter Using two’s Complement form convert the following from Denary to Binary using 8 bits. Answer on mini whiteboard Using two’s.
CHAPTER 5: Representing Numerical Data
Floating Point Numbers
Department of Computer Science Georgia State University
Recap Add these numbers together in binary
A Level Computing Component 2
Binary Numbers Material on Data Representation can be found in Chapter 2 of Computer Architecture (Nicholas Carter) CSC 370 (Blum)
Chapter 2 Bits, Data Types & Operations Integer Representation
Data Representation Conversion 05/12/2018.
Number Representation
Storing Negative Integers
23/04/2019 Data Representation Conversion.
Two’s Complement & Binary Arithmetic
Section 6 Primitive Data Types
Presentation transcript:

Extending Binary In today’s lesson we will look at: representing different types of numbers possible errors binary coded decimal (BCD) comparing BCD with pure binary

Binary So far we have looked at how to represent small positive integers – i.e. whole numbers – in binary x2 As we move left, the column headings increase by a factor of two In each column we can have two different digits (0 or 1) This number is: = 13 It’s still thirteen, it’s just written down differently

Other Types of Numbers It’s unlikely that we’d only want to deal with small positive numbers. Computers can also cope with: –decimals and very small numbers –negative numbers –large numbers So how do they do it?

Decimals in Binary Binary can represent decimals in the same way as we represent decimals in denary x /4 1/16 1/21/8 ÷2÷2 ÷2÷2 ÷2÷2 On the left we have = 5 On the right we have ½ + ¼ = ¾ So, in binary is 5 ¾ in denary!

Underflow Overflow is the name we give to the situation where a number is too big to fit into the allocated numbers of bits. It is also possible for a number to be too small to fit into the amount of space allocated – i.e. there are too many zeros after the decimal point but before the first digit. This is known as underflow.

Quantisation Error Another problem that can occur is called quantisation error. This is where the computer can’t accurately represent a value because it falls between two “steps”. When recording data such as sound waves, this can lead to distortion.

Floating Point Binary You might be familiar with standard (or scientific) form, e.g. 6 x This is the binary equivalent: Mantissa: is 1 1/8Exponent: 2 5 = /8 x 32 = 36 Floating point representations are a way of increasing both range and precision.

Negative Numbers We’ve already seen that negative numbers in binary can be represented using a twos-complement. A ones-complement takes all of the digits and swaps 1s for 0s and vice versa – e.g. for the number 3: A twos-complement just takes this number and adds one to it: 1101 This is -3 in twos- complement form

Negative Numbers Think about a car odometer going backwards: Sign = 1 = = = -2 In this way, we can represent numbers from -127 to 127.

Binary-Coded Decimal All of our lessons on binary have looked at pure binary – working in base 2. There is also a system called binary- coded decimal. Rather than converting the whole number to binary, we convert it a digit at a time. The process is identical to hexadecimal conversion, except that values are less than ten (rather than less than sixteen).

Converting to BCD Converting to BCD is straightforward – just take each digit and convert it to four binary bits We then concatenate the results, so that 64 in decimal becomes in binary.

Converting from BCD Changing back from BCD is the reverse process – split the bits into groups of four and convert: We then concatenate the results, so that in BCD is 97 in decimal.

Benefits of BCD? Some decimal values, such as 0.2, are non- terminating in binary ( ), which can lead to rounding errors, but can be represented exactly in BCD (0.0010). Scaling by a factor of 10 (or a power of 10) is simple; this can be useful when doing financial calculations – e.g. converting from pence to £s. Rounding to a fixed number of decimal places is easier. Displaying values is easier – e.g. displaying on a seven-segment display (like those used in digital clocks).

Disadvantages of BCD Some operations – e.g. adding - are more complex to implement. Adders for BCD require 15–20% more circuitry than those for pure binary. Standard BCD requires four bits per digit - roughly 20 percent more space than pure binary Systems using BCD are typically slower than those that use pure binary, due to limited processor support for native BCD operations.