1 Floating Point Operations - Part II. Multiplication Do unsigned multiplication on the mantissas including the hidden bits Do unsigned multiplication.

Slides:



Advertisements
Similar presentations
Arithmetic in Computers Chapter 4 Arithmetic in Computers2 Outline Data representation integers Unsigned integers Signed integers Floating-points.
Advertisements

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.
Binary Arithmetic Binary addition Binary subtraction
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3: IT Students.
Floating Point Representation in Computers Floating Point Numbers - What are they? Floating Point Representation Floating Point Operations Where Things.
Floating Point Numbers
1 IEEE Floating Point Revision Guide for Phase Test Week 5.
1 Lecture 9: Floating Point Today’s topics:  Division  IEEE 754 representations  FP arithmetic Reminder: assignment 4 will be posted later today.
Chapter 3 Arithmetic for Computers. Multiplication More complicated than addition accomplished via shifting and addition More time and more area Let's.
CMPE12cCyrus Bazeghi 1 What do floating-point numbers represent? Rational numbers with non-repeating expansions in the given base within the specified.
Major Numeric Data Types Unsigned Integers Signed Integer Alphanumeric Data – ASCII & UNICODE Floating Point Numbers.
Dr Damian Conway Room 132 Building 26
CMPE12cGabriel Hugh Elkaim 1 What do floating-point numbers represent? Rational numbers with non-repeating expansions in the given base within the specified.
1  2004 Morgan Kaufmann Publishers Chapter Three.
Integer Arithmetic Floating Point Representation Floating Point Arithmetic Topics.
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
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Computer ArchitectureFall 2008 © August 27, CS 447 – Computer Architecture Lecture 4 Computer Arithmetic (2)
Simple Data Type Representation and conversion of numbers
Information Representation (Level ISA3) Floating point numbers.
Computer Organization and Architecture Computer Arithmetic Chapter 9.
Computer Arithmetic Nizamettin AYDIN
Computer Architecture Lecture 3: Logical circuits, computer arithmetics Piotr Bilski.
Fixed-Point Arithmetics: Part II
Computing Systems Basic arithmetic for computers.
ECE232: Hardware Organization and Design
Data Representation - Part II. Characters A variable may not be a non-numerical type Character is the most common non- numerical type in a programming.
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,
07/19/2005 Arithmetic / Logic Unit – ALU Design Presentation F CSE : Introduction to Computer Architecture Slides by Gojko Babić.
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
Oct. 18, 2007SYSC 2001* - Fall SYSC2001-Ch9.ppt1 See Stallings Chapter 9 Computer Arithmetic.
ECEG-3202: Computer Architecture and Organization, Dept of ECE, AAU 1 Floating-Point Arithmetic Operations.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Fixed and Floating Point Numbers Lesson 3 Ioan Despi.
Lecture 9: Floating Point
CSC 221 Computer Organization and Assembly Language
Floating Point Arithmetic
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.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication
Computer Architecture Lecture 22 Fasih ur Rehman.
Number Systems & Operations
Floating Point Numbers Representation, Operations, and Accuracy CS223 Digital Design.
Module 2.2 Errors 03/08/2011. Sources of errors Data errors Modeling Implementation errors Absolute and relative errors Round off errors Overflow and.
Cosc 2150: Computer Organization Chapter 9, Part 3 Floating point numbers.
William Stallings Computer Organization and Architecture 8th Edition
Floating Point Representations
Integer Division.
Lecture 9: Floating Point
Floating Point Number system corresponding to the decimal notation
CSCE 350 Computer Architecture
Number Representations
Floating Point Arithmetic
How to represent real numbers
ECEG-3202 Computer Architecture and Organization
Number Representations
Floating Point Arithmetic
Presentation transcript:

1 Floating Point Operations - Part II

Multiplication Do unsigned multiplication on the mantissas including the hidden bits Do unsigned multiplication on the mantissas including the hidden bits Add the true exponents or unbias one of the exponents (subtract 127 from it) then perform 2’s complement addition Add the true exponents or unbias one of the exponents (subtract 127 from it) then perform 2’s complement addition Normalize the result Normalize the result Set the sign bit of the result Set the sign bit of the result

Setting the Sign bit The following table gives the sign bit of the result:

Example x (1) x (1) x (1) (1) (1) (1) least 16 bits eliminated Unbias (subtract 127) one of exponent, then perform 2’s complement addition mantissas exponents already normalized 14 bits

Division Do unsigned division of the mantissas Do unsigned division of the mantissas Subtract the exponent of the divisor from the exponent of the dividend Subtract the exponent of the divisor from the exponent of the dividend Normalize the result Normalize the result Set the sign bit of the result Set the sign bit of the result

Setting the sign bit of the quotient The sign bit of the quotient is set using the following table:

Rounding In floating point operations, some results may not be representable. In floating point operations, some results may not be representable. There is always a small amount of error incurred during rounding. There is always a small amount of error incurred during rounding. Error tend to accumulate over time Error tend to accumulate over time Operations performed in a different order might give different results Operations performed in a different order might give different results Exact comparison of two floating point variables is infeasible Exact comparison of two floating point variables is infeasible

Example 13.1 Suppose x = x 10 38, y = x and z = 1.0 and suppose these are single-precision numbers. x+(y+z)= x ( x ) = x x = 0.0 = x x = 0.0 (x+y)+z= ( x x 10 38) = = 1.0 = = 1.0 Floating point addition is not associative.

Rounding Rules Round to nearest. Same as taught in school. In case of tie, if the lsb is 1 add a 1; if the lsb is a 0 truncate. The lsb is always 0. Round to nearest. Same as taught in school. In case of tie, if the lsb is 1 add a 1; if the lsb is a 0 truncate. The lsb is always 0. Round toward zero. Truncate the magnitude to the correct number of bits. Round toward zero. Truncate the magnitude to the correct number of bits. Round toward positive infinity. The least positive value representable that is not arithmetically less than the unrounded value is chosen. Round toward positive infinity. The least positive value representable that is not arithmetically less than the unrounded value is chosen. Round toward negative infinity. The least negative value representable but not arithmetically greater than the unrounded value is chosen. Round toward negative infinity. The least negative value representable but not arithmetically greater than the unrounded value is chosen.

Overflow Overflow occurs when the exponent of the normalized result is outside the range of values representable Overflow occurs when the exponent of the normalized result is outside the range of values representable The smallest number that can be represented normally has an exponent of The smallest number that can be represented normally has an exponent of e = -126, i.e. E = 1 = and the largest number has an exponent of e = 127, i.e. E = 254 = e = -126, i.e. E = 1 = and the largest number has an exponent of e = 127, i.e. E = 254 =

The IEEE FPS assigns special meaning for extreme values of the exponent The IEEE FPS assigns special meaning for extreme values of the exponent -  (S=1,E=255,F=0) -  (S=1,E=255,F=0) +  (S=0,E=255,F=0) +  (S=0,E=255,F=0) NaN (E=255,F  0) NaN (E=255,F  0) 0 (E=0,F=0) 0 (E=0,F=0)

Underflow Underflow occurs when the result is too close to zero to be represented Underflow occurs when the result is too close to zero to be represented Repeatedly dividing a number by a positive constant results in values that will approach zero but may never be zero, e.g. 1 divide by 10 repetitively Repeatedly dividing a number by a positive constant results in values that will approach zero but may never be zero, e.g. 1 divide by 10 repetitively In these cases, floating point operations after some iteration will eventually return zero In these cases, floating point operations after some iteration will eventually return zero

Until underflow occurs, the computation is reversible, i.e. if we multiply the current result by the constant the same number of times we have divided it, it will return the original number Until underflow occurs, the computation is reversible, i.e. if we multiply the current result by the constant the same number of times we have divided it, it will return the original number Once, underflow occurs any number of multiplication will still produce zero Once, underflow occurs any number of multiplication will still produce zero