Floating Point Numbers

Slides:



Advertisements
Similar presentations
Roundoff and truncation errors
Advertisements

2009 Spring Errors & Source of Errors SpringBIL108E Errors in Computing Several causes for malfunction in computer systems. –Hardware fails –Critical.
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
CENG536 Computer Engineering department Çankaya University.
Topics covered: Floating point arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Representing fractions – Fixed point The problem: How to represent fractions with finite number of bits ?
1 IEEE Floating Point Revision Guide for Phase Test Week 5.
Lecture 3 Number Representation 2 This week – Recap Addition – Addition circuitry – Subtraction of integers in binary – Representing numbers with fractional.
CSE 378 Floating-point1 How to represent real numbers In decimal scientific notation –sign –fraction –base (i.e., 10) to some power Most of the time, usual.
Floating Point Numbers
Floating Point Numbers.  Floating point numbers are real numbers.  In Java, this just means any numbers that aren’t integers (whole numbers)  For example…
Operations on data CHAPTER 4.
The Binary Number System
Simple Data Type Representation and conversion of numbers
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
Number Systems II Prepared by Dr P Marais (Modified by D Burford)
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Data Representation Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
Floating Point Arithmetic
Fractions in Binary.
CSPP58001 Floating Point Numbers. CSPP58001 Floating vs. fixed point Floating point refers to a binary decimal representation where there is not a fixed.
Floating Point in Binary 1.Place Value Chart:
COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.7 Instructor: Lin Chen Sept 2013.
Learning Objectives 3.3.1f - Describe the nature and uses of floating point form 3.3.1h - Convert a real number to floating point form Learn how to normalise.
Software Design and Development Storing Data Computing Science.
FLOATING-POINT NUMBER REPRESENTATION
MATH Lesson 2 Binary arithmetic.
Lesson Objectives Aims You should know about: Binary numbers ‘n’ that.
Floating Point Numbers
Introduction to Numerical Analysis I
Floating Point Representations
Department of Computer Science Georgia State University
Fundamentals of Computer Science
Data Representation Covering… Binary addition / subtraction
Binary Numbers The arithmetic used by computers differs in some ways from that used by people. Computers perform operations on numbers with finite and.
A brief comparison of integer and double representation
Introduction To Computer Science
Integer Division.
Floating Point Numbers: x 10-18
Chapter 3 Data Storage.
Numbers in a Computer Unsigned integers Signed magnitude
Floating Point Number system corresponding to the decimal notation
CS 232: Computer Architecture II
IEEE floating point format
A Level Computing Component 2
Outline Introduction Floating Point Arithmetic Adder Multiplier.
Luddy Harrison CS433G Spring 2007
CSCE 350 Computer Architecture
Number Representations
Floating Point Representation
Scientific Notation.
How to represent real numbers
How to represent real numbers
COMS 361 Computer Organization
Storing Negative Integers
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
Numbers representations
Representation of real numbers
Floating Point Numbers
Normalised Floating Point Numbers
Floating Point Numbers
Data Binary Arithmetic.
Scientific Notation.
Chapter3 Fixed Point Representation
Floating Point Binary Part 1
靜夜思 床前明月光, 疑是地上霜。 舉頭望明月, 低頭思故鄉。 ~ 李白 李商隱.
Number Representations
1.6) Storing Integer: 1.7) storing fraction:
Lecture 9: Shift, Mult, Div Fixed & Floating Point
Presentation transcript:

Floating Point Numbers Photocopiable/digital resources may only be copied by the purchasing institution on a single site and for their own use © ZigZag Education, 2016

Floating Point Floating point is an alternative method of representing binary numbers with a fractional part. As the name suggests, the binary point can move or ‘float’. A floating-point number is divided into two parts: the mantissa and the exponent. 1 1 Mantissa Exponent This is the actual number Sets the position of the binary point © ZigZag Education, 2016

Floating Point There are many different formats of floating-point representation; here we are going to be working with the two’s complement version. 8 4 2 1 1/2 1/4 1/8 1/16 1 Mantissa Exponent The value of the exponent is 3, so we need to move the binary point three places to the right. 4 + 2 + 0.5 = 6.5 © ZigZag Education, 2016

Another Example Both the mantissa and the exponent are in two’s complement format. If either starts with a 1 it needs to be converted to a positive number by flipping the bits and adding 1. 16 8 4 2 1 1/2 1/4 1/8 4 2 1 1/2 1/4 1/8 1/16 1/32 4 2 1 1/2 1/4 1/8 1/16 1/32 1 Mantissa Exponent 8 + 2 + 0.25 + 0.125 = -10.375 10.375 We know the result is a negative number because the mantissa is negative. © ZigZag Education, 2016

Negative Exponents If the exponent is negative we shift the binary point to the left rather than to the right. First we have to convert the exponent to a positive value to work out the number of places the binary point needs to shift. 1 1/2 1/4 1/8 1/16 1/32 1 1 Mantissa Exponent 0.25 © ZigZag Education, 2016

The repeated values need to be removed and the binary point moved. Normalisation When representing numbers in binary we want to ensure we use the smallest number of bits possible; to do this we normalise the numbers. To normalise a number you look at the start of the mantissa to see whether there are any repeated numbers. 1 1 The repeated values need to be removed and the binary point moved. The binary point has moved one place so the exponent needs to be updated by subtracting 1 from it. © ZigZag Education, 2016

Comparison It is faster to process calculations using fixed-point numbers compared to floating-point numbers. Floating-point numbers can represent a larger range of numbers with fractional parts when compared to fixed-point numbers. This means that floating-point numbers are best suited to situations where you need to represent a wide range of values. On the other hand, fixed-point numbers are best used when the speed of processing is more important than precision. © ZigZag Education, 2016

The difference between the actual number and the rounded number Rounding Errors Some numbers cannot be represented using the number of bits allocated to them. In this case the number is rounded to the nearest representable number. The rounding error is the difference between the actual value and the rounded value. There are two different methods of measuring the precision of a rounded value: Absolute Error The difference between the actual number and the rounded number Relative Error The difference between the actual number and rounded number divided by the actual number © ZigZag Education, 2016

Example If we wanted to represent the decimal value 5.6 using 8-bit fixed-point binary we would end up with: 101.10011 (5.59375) The absolute error is: 5.6 - 5.59375 = 0.00625 The relative error is: 0.00625 / 5.6 = 0.0011160714285714 © ZigZag Education, 2016

END