Floating Point Arithmetic

Slides:



Advertisements
Similar presentations
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Advertisements

Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3: IT Students.
Floating Point Numbers
COMP3221: Microprocessors and Embedded Systems Lecture 14: Floating Point Numbers Lecturer: Hui Wu Session 2, 2004.
1 Lecture 9: Floating Point Today’s topics:  Division  IEEE 754 representations  FP arithmetic Reminder: assignment 4 will be posted later today.
CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (2)
Computer ArchitectureFall 2007 © September 5, 2007 Karem Sakallah CS 447 – Computer Architecture.
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.
CMPE12cGabriel Hugh Elkaim 1 What do floating-point numbers represent? Rational numbers with non-repeating expansions in the given base within the specified.
Integer Arithmetic Floating Point Representation Floating Point Arithmetic Topics.
1 Module 2: Floating-Point Representation. 2 Floating Point Numbers ■ Significant x base exponent ■ Example:
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
Computer ArchitectureFall 2008 © August 27, CS 447 – Computer Architecture Lecture 4 Computer Arithmetic (2)
Computer Organization and Architecture Computer Arithmetic Chapter 9.
Computer Arithmetic Nizamettin AYDIN
Number Systems II Prepared by Dr P Marais (Modified by D Burford)
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
Floating Point (a brief look) We need a way to represent –numbers with fractions, e.g., –very small numbers, e.g., –very large numbers,
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
9.4 FLOATING-POINT REPRESENTATION
Fixed and Floating Point Numbers Lesson 3 Ioan Despi.
Lecture 9: Floating Point
Lecture 12: Integer Arithmetic and Floating Point CS 2011 Fall 2014, Dr. Rozier.
Conversion to Larger Number of Bits Ex: Immediate Field (signed 16 bit) to 32 bit Positive numbers have implied 0’s to the left. So, put 16 bit number.
1 Number Systems Lecture 10 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication
1 Floating Point Operations - Part II. Multiplication Do unsigned multiplication on the mantissas including the hidden bits Do unsigned multiplication.
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
CS 232: Computer Architecture II Prof. Laxmikant (Sanjay) Kale Floating point arithmetic.
King Fahd University of Petroleum and Minerals King Fahd University of Petroleum and Minerals Computer Engineering Department Computer Engineering Department.
Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001.
Floating Point Arithmetic – Part I
Chapter 9 Computer Arithmetic
William Stallings Computer Organization and Architecture 8th Edition
Floating Point Representations
Computer Science 210 Computer Organization
Computer Architecture & Operations I
Lecture 9: Floating Point
Floating Point Numbers: x 10-18
NxN Crossbar design for Barrel Shifter
Floating Point Number system corresponding to the decimal notation
Expressible Numbers.
Morgan Kaufmann Publishers
April 2006 Saeid Nooshabadi
PRESENTED BY J.SARAVANAN. Introduction: Objective: To provide hardware support for floating point arithmetic. To understand how to represent floating.
William Stallings Computer Organization and Architecture 7th Edition
Outline Introduction Floating Point Arithmetic Adder Multiplier.
ECE/CS 552: Floating Point
Number Representations
How to represent real numbers
How to represent real numbers
ECEG-3202 Computer Architecture and Organization
Computer Architecture
Chapter 8 Computer Arithmetic
Morgan Kaufmann Publishers Arithmetic for Computers
Topic 3d Representation of Real Numbers
Numbers with fractions Could be done in pure binary
Number Representations
Floating Point Arithmetic
Lecture 9: Shift, Mult, Div Fixed & Floating Point
Presentation transcript:

Floating Point Arithmetic “Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.” ― Albert Einstein

MIPS FPU

Single Precision Format S 1 sign bit E 8 bits biased 127 F 23 bit significand (normalized) 32 bits 32 bit SEF FPS SEEEEEEE EFFFFFFF FFFFFFFF FFFFFFFF

Single Precision Representation in IEEE FPS 32 bit SEF SEEEEEEE EFFFFFFF FFFFFFFF FFFFFFFF S - sign, 0=positive, 1=negative E - exponent, biased 127 F - fraction, normalized with hidden bit

Representation in IEEE FPS showing the hidden bit 32 bit SEF SEEEEEEE E(1)FFFFFFF FFFFFFFF FFFFFFFF - because the fraction is normalized the hidden bit is always 1

Double Precision Format S 1 sign bit E 11 bits biased 1023 F 52 bit significand (normalized) 64 bits 64 bit SEF SEEEEEEE EEEEFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF

Addition and Subtraction Align radix points adjust the fraction and exponent of the number with the smaller exponent Add or subtract the mantissas Normalize the result Scientific Notation Examples 1.5 x 102 + 2.0 x 101 = ? 5.5 x 102 + 6.5 x 102 = ?

Example 1 1.5 x 102 + 2.0 x 101 1.5 x 102 + 0.20 x 102 1.70 x 102 OR 170 1.5 x 102 + 2.0 x 101 1.0010110 x 27 1.0100 x 24 adjust 0.0010100 x 27 So 1.0010110 x 27 1.0101010 x 27 170 Shift to line up radix points

Example 2 5.5 x 102 + 6.5 x 102 5.5 x 102 6.5 x 102 12.00 x 102 1.20 x 103 120010 5.5 x 102 + 6.5 x 102 1.000100110 x 29 1.010001010 x 29 10.010110000 x 29 1.0010110000 x 210 120010 Shift right once to normalize Shift right once to normalize

Multiplication Do unsigned multiplication on mantissas Add the (biased) exponents Normalize the result Set the sign bit of the result XOR or the sign bits Example (1.25 x 102) x (2.0 x 101)

Division Do unsigned division on mantissas Subtract (biased) exponent of divisor from (biased) exponent of dividend Normalize the result Set the sign bit of the result XOR of sign bits

Undesirable effects of Rounding Errors accumulate over time Operations performed in a different order may give a different result Infeasible to do an exact comparison of two floating point numbers

Overflow and Underflow overflow - the number is too large.. the biased exponent is too large to fit in 8 bits i.e. > 1111 1110 > 127 underflow - the number is too small the biased exponent is too small to fit in 8 bits i.e. < 000 0001 < -126

End