CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Fall 2006 Lecture 9: Floating Point Numbers.

Slides:



Advertisements
Similar presentations
Fixed Point Numbers The binary integer arithmetic you are used to is known by the more general term of Fixed Point arithmetic. Fixed Point means that we.
Advertisements

Fabián E. Bustamante, Spring 2007 Floating point Today IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time.
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Carnegie Mellon Instructors: Dave O’Hallaron, Greg Ganger, and Greg Kesden Floating Point : Introduction to Computer Systems 4 th Lecture, Sep 6,
1 Binghamton University Floating Point CS220 Computer Systems II 3rd Lecture.
Carnegie Mellon Instructors: Randy Bryant & Dave O’Hallaron Floating Point : Introduction to Computer Systems 3 rd Lecture, Aug. 31, 2010.
Copyright 2008 Koren ECE666/Koren Part.4b.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
Floating Point in computers Comply with standards: IEEE 754 ISO/IEC 559.
Datorteknik FloatingPoint bild 1 Floating point Number system corresponding to the decimal notation 1,837 * 10 significand exponent a great number of corresponding.
University of Washington Today Topics: Floating Point Background: Fractional binary numbers IEEE floating point standard: Definition Example and properties.
1 CSE1301 Computer Programming Lecture 30: Real Number Representation.
Floating Point Arithmetic August 25, 2007
Integer Arithmetic Floating Point Representation Floating Point Arithmetic Topics.
CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Winter 2004 Lecture 9.
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 COMPUTER ARCHITECTURE AND ORGANIZATION.
Computer Organization and Architecture Computer Arithmetic Chapter 9.
Computer Architecture
Floating Point Numbers Topics –IEEE Floating Point Standard –Rounding –Floating Point Operations –Mathematical properties.
Instructor: Andrew Case Floating Point Slides adapted from Randy Bryant & Dave O’Hallaron.
Carnegie Mellon Instructors: Greg Ganger, Greg Kesden, and Dave O’Hallaron Floating Point : Introduction to Computer Systems 4 th Lecture, Sep 4,
Bryant and O’Hallaron, Computer Systems: A Programmer’s Perspective, Third Edition Carnegie Mellon Instructor: San Skulrattanakulchai Floating Point MCS-284:
Computer Arithmetic Floating Point. We need a way to represent –numbers with fractions, e.g., –very small numbers, e.g., –very large.
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Floating Point Numbers Representation, Operations, and Accuracy CS223 Digital Design.
Carnegie Mellon Instructors: Randy Bryant, Dave O’Hallaron, and Greg Kesden Floating Point : Introduction to Computer Systems 4 th Lecture, Sep 5,
Number Representation Fixed and Floating Point
10/7/2004Comp 120 Fall October 7 Read 5.1 through 5.3 Register! Questions? Chapter 4 – Floating Point.
1 Floating Point. 2 Topics Fractional Binary Numbers IEEE 754 Standard Rounding Mode FP Operations Floating Point in C Suggested Reading: 2.4.
Floating Point Carnegie Mellon /18-243: Introduction to Computer Systems 4 th Lecture, 26 May 2011 Instructors: Gregory Kesden.
Lecture 4 IEEE 754 Floating Point Topics IEEE 754 standard Tiny float January 25, 2016 CSCE 212 Computer Architecture.
Floating Point Topics IEEE Floating-Point Standard Rounding Floating-Point Operations Mathematical Properties CS 105 “Tour of the Black Holes of Computing!”
Floating Point CSE 238/2038/2138: Systems Programming
Floating Point Borrowed from the Carnegie Mellon (Thanks, guys!)
Floating Point Numbers
CS 105 “Tour of the Black Holes of Computing!”
Part III The Arithmetic/Logic Unit
2.4. Floating Point Numbers
Integer Division.
Topics IEEE Floating Point Standard Rounding Floating Point Operations
CS 105 “Tour of the Black Holes of Computing!”
Floating Point Number system corresponding to the decimal notation
CS 232: Computer Architecture II
IEEE floating point format
CS 367 Floating Point Topics (Ch 2.4) IEEE Floating Point Standard
PRESENTED BY J.SARAVANAN. Introduction: Objective: To provide hardware support for floating point arithmetic. To understand how to represent floating.
Arithmetic for Computers
ECE/CS 552: Floating Point
Number Representations
CSCI206 - Computer Organization & Programming
CS 105 “Tour of the Black Holes of Computing!”
How to represent real numbers
CS 105 “Tour of the Black Holes of Computing!”
Floating Point Arithmetic August 31, 2009
CS 105 “Tour of the Black Holes of Computing!”
October 17 Chapter 4 – Floating Point Read 5.1 through 5.3 1/16/2019
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
CS 105 “Tour of the Black Holes of Computing!”
CS213 Floating Point Topics IEEE Floating Point Standard Rounding
UNIVERSITY OF MASSACHUSETTS Dept
CS 105 “Tour of the Black Holes of Computing!”
Number Representations
CSE 140: Computer Arithmetic Algorithms and Hardware Design
CSE140 Final Review Xinyuan Wang 06/06/2019.
CS 105 “Tour of the Black Holes of Computing!”
Presentation transcript:

CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Fall 2006 Lecture 9: Floating Point Numbers

CSE 2462 Motivation  Maximal information with given bit numbers.  Arithmetic with proper precision.  Fairness of rounding.  Features at the expenses of the complexity of the operations.

CSE 2463 Topics:  Floating Point Numbers (IEEE P754)  Standard  Operations  Exceptional Situations  Rounding Modes  Numerical Computing with IEEE Floating Point Arithmetic, Michael L. Overton, SIAM

CSE 2464 Standard 2 32  Typically  Goal: Dynamic Range: largest #/ smallest #  If too large, holes between # ’ s

CSE 2465 Standard  ulp (unit in the last place)  Difference between two consecutive values of the significand. 3 Parts  x = ~s b e :sign, significand, exponent Sign Bit 8-bit exponent 23-bit Significand

CSE 2466 Standard  ~ e 1 e 2 e 3 e 4 e 5 e 6 e 7 e 8 s 1 s 2 s 3 … s 22 s s 1 s 2 s 3 … s 22 s 23 normalized number 0. s 1 s 2 s 3 … s 22 s 23 denormalized number e 1 e 2 e 3 e 4 e 5 e 6 e 7 e x= 0.s 1 s 2 s 3 … s 22 s x= 1.s 1 s 2 s 3 … s 22 s x= 1.s 1 s 2 s 3 … s 22 s x= 1.s 1 s 2 s 3 … s 22 s x= 1.s 1 s 2 s 3 … s 22 s x= 1.s 1 s 2 s 3 … s 22 s x= Inf if (s 1 … s 23 )= 0, NaN otherwise. NaN  Not a Number

CSE 2467 Standard 0.01x2 -3 = 0.001x2 -2  Same number, so normalize to remove redundancy  Use a default 1 in front for one more bit precision.  Smallest Number 0.00 … 01x = 1.0x2 -23 x = 1x2 -149

CSE 2468 Standard - Example ~ eeeeeeee sssss sssss sssss sssss sss = … 0x = … 0x = … 1x = … 0x normalized minimum = … 1x = … 0x = … 1x = … 1x2 1

CSE 2469 Standard – Example Cont = … 0x = … 1x = … 1x Normalized Maximum = Inf N min = 1.0 x N max = (2 – )2 127

CSE Double Floating Point ~ e 1 e 2 … e 11 s 1 s 2 … s … 000 s 1 s 2 … s 52 x=0.s 1 s 2 … s … 001 s 1 s 2 … s 52 x=1.s 1 s 2 … s … 111 s 1 s 2 … s 52 x=1.s 1 s 2 … s … 000 s 1 s 2 … s 52 x=1.s 1 s 2 … s … 110 s 1 s 2 … s 52 x=1.s 1 s 2 … s … 111 s 1 s 2 … s 52 x=Inf if (s 1 … s 52 )=0

CSE Overflow/Underflow N max N min SparserDenser Overflow Underflow

CSE Addition/Multiplication  ~s 1 xb e1 + (~s 2 xb e2 ) = ~sxb e = ~s 1 xb e1 + ~s 2 /b e1-e2 x b e1 = (~s 1 + ~s 2 /b e1-e2 ) x b e1  (~s 1 xb e1 ) x (~s 2 xb e2 ) = ~(s 1 xs 2 )b e1+e2

CSE Exceptions a/0 = Inf if a > 0 a/Inf = 0if a != 0 a · 0 = 0 a · Inf = Inf if a > 0 a + Inf = Inf 0 · Inf = invalid operation (NaN) 0/0 = invalid operation (NaN) Inf - Inf = NaN NaP op a = NaN

CSE Rounding Mode  Adder Output = C out z 1 z 0.z -1 z -2 … z - l GRS Guard Bit Round Bit Sticky Bit, OR of all bits below bit R x x x x2 4 Normalize – need to round or

CSE Rouding normalize Guard bit

CSE Rounding  Round to the nearest even toward Toward + Inf Toward - Inf

CSE Conventional Rounding Error Rounding Error  1.101=  1.101=  =  = Average Error = 0.5/4 = 0.125