CSPP58001 Floating Point Numbers. CSPP58001 Floating vs. fixed point Floating point refers to a binary decimal representation where there is not a fixed.

Slides:



Advertisements
Similar presentations
4. Floating Point Numbers. Exponential Notation The representations differ in that the decimal place – the “point” -- “floats” to the left or right (with.
Advertisements

Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Topics covered: Floating point arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Floating Point Numbers
1 IEEE Floating Point Revision Guide for Phase Test Week 5.
CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (2)
1 CSE1301 Computer Programming Lecture 30: Real Number Representation.
Booth’s Algorithm.
CMPE12cCyrus Bazeghi 1 What do floating-point numbers represent? Rational numbers with non-repeating expansions in the given base within the specified.
CSE1301 Computer Programming Lecture 33: Real Number Representation
Number Systems Standard positional representation of numbers:
1 Lecture 3 Bit Operations Floating Point – 32 bits or 64 bits 1.
Representing Real Numbers Using Floating Point Notation Lecture 6 CSCI 1405, CSCI 1301 Introduction to Computer Science Fall 2009.
Floating Point Numbers
Computer Science 210 Computer Organization Floating Point Representation.
Floating Point Numbers.  Floating point numbers are real numbers.  In Java, this just means any numbers that aren’t integers (whole numbers)  For example…
Binary Number Systems.
School of Computer Science G51CSA 1 Computer Arithmetic.
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.
Computer Arithmetic Nizamettin AYDIN
Number Systems II Prepared by Dr P Marais (Modified by D Burford)
1 Lecture 5 Floating Point Numbers ITEC 1000 “Introduction to Information Technology”
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Information Representation: Negative and Floating Point.
Number Systems So far we have studied the following integer number systems in computer Unsigned numbers Sign/magnitude numbers Two’s complement numbers.
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
Data Representation in Computer Systems
Floating Point (a brief look) We need a way to represent –numbers with fractions, e.g., –very small numbers, e.g., –very large numbers,
Binary Fractions. Fractions A radix separates the integer part from the fraction part of a number Columns to the right of the radix have negative.
CSC 221 Computer Organization and Assembly Language
ITEC 1011 Introduction to Information Technologies 4. Floating Point Numbers Chapt. 5.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI N305 Information Representation: Floating Point Representation.
Number Representation for
Fractions in Binary.
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Floating Point in Binary 1.Place Value Chart:
Data Representation: Floating Point for Real Numbers Computer Organization and Assembly Language: Module 11.
Floating Point Numbers
SCIENTIFIC NOTATION Expressing a quantity as: a number between 1 and 10 multiplied by 10 to the appropriate power.
COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.7 Instructor: Lin Chen Sept 2013.
Lecture 6: Floating Point Number Representation Information Representation: Floating Point Number Representation Lecture # 7.
Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001.
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.
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
Chapter 9 Computer Arithmetic
FLOATING-POINT NUMBER REPRESENTATION
Floating Point Numbers
Introduction to Numerical Analysis I
Fundamentals of Computer Science
Data Representation Covering… Binary addition / subtraction
Computer Science 210 Computer Organization
Introduction To Computer Science
Dr. Clincy Professor of CS
Integer Division.
Floating Point Number system corresponding to the decimal notation
Luddy Harrison CS433G Spring 2007
CSCI206 - Computer Organization & Programming
Computer Science 210 Computer Organization
ECEG-3202 Computer Architecture and Organization
Storing Integers and Fractions
Scientific Notation.
Numbers with fractions Could be done in pure binary
Presentation transcript:

CSPP58001 Floating Point Numbers

CSPP58001 Floating vs. fixed point Floating point refers to a binary decimal representation where there is not a fixed number of digits before and after the decimal place (contrast “fixed point”). The decimal is said to be allowed to “float” Virtually all general purpose modern processors are based on ieee-754 floating point standard Allows representation of much greater range of numbers at cost of greater overhead

CSPP58001 Exponential Notation The representations differ in that the decimal place – the “point” -- “floats” to the left or right (with the appropriate adjustment in the exponent). The following are equivalent representations of 1, ,400.0 x ,340.0 x ,234.0 x x x x x 10 4

CSPP58001 Parts of a Floating Point Number x p. 123 Sign of mantissa Location of decimal point Mantissa Exponent Sign of exponent Base

CSPP58001 IEEE 754 Standard Most common standard for representing floating point numbers Single precision: 32 bits, consisting of... Sign bit (1 bit) Exponent (8 bits) Mantissa (23 bits) Double precision: 64 bits, consisting of… Sign bit (1 bit) Exponent (11 bits) Mantissa (52 bits) p. 133

CSPP58001 Single Precision Format 32 bits Mantissa (23 bits) Exponent (8 bits) Sign of mantissa (1 bit)

CSPP58001 Normalization The mantissa is normalized Has an implied decimal place on left Has an implied “1” on left of the decimal place E.g., Mantissa  Represents… =

CSPP58001 Excess Notation To include + and – exponents, “excess” notation is used Single precision: excess 127 Double precision: excess 1023 The value of the exponent stored is larger than the actual exponent E.g., excess 127, Exponent  Represents… – 127 = 8

CSPP58001 Example Single precision – 127 = 3 0 = positive mantissa x 2 3 = =

CSPP58001 Hexadecimal It is convenient and common to represent the original floating point number in hexadecimal The preceding example…

CSPP58001 Converting from Floating Point E.g., What decimal value is represented by the following 32-bit floating point number? C17B

CSPP58001 Step 1 Express in binary and find S, E, and M C17B = SEM 1 = negative 0 = positive

CSPP58001 Step 2 Find “real” exponent, n n= E – 127 = – 127 = 130 – 127 = 3

CSPP58001 Step 3 Put S, M, and n together to form binary result (Don’t forget the implied “1.” on the left of the mantissa.) x 2 n = x 2 3 =

CSPP58001 Step 4 Express result in decimal = = = Answer:

CSPP58001 Converting to Floating Point E.g., Express as a 32-bit floating point number (in hexadecimal)

CSPP58001 Step 1 Express original value in binary =

CSPP58001 Step 2 Normalize = x 2 5

CSPP58001 Step 3 Determine S, E, and M x 2 5 S = 0 (because the value is positive) MS n E= n = = 132 =

CSPP58001 Step 4 Put S, E, and M together to form 32-bit binary result SEM

CSPP58001 Step 5 Express in hexadecimal = Answer:

CSPP58001 Floating point operations Addition, subtraction very simple Match exponents by shifting decimal place Perform regular bitwise addition Renormalize Note that this process is in general not exact. Rounding and loss of precision inevitable.s