CMPE12cCyrus Bazeghi 1 What do floating-point numbers represent? Rational numbers with non-repeating expansions in the given base within the specified.

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

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.
Datorteknik FloatingPoint bild 1 Floating point Number system corresponding to the decimal notation 1,837 * 10 significand exponent a great number of corresponding.
Floating Point Numbers
Chapter 3 Arithmetic for Computers. Multiplication More complicated than addition accomplished via shifting and addition More time and more area Let's.
CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (2)
Computer ArchitectureFall 2007 © September 5, 2007 Karem Sakallah CS 447 – Computer Architecture.
Floating Point Numbers. CMPE12cCyrus Bazeghi 2 Floating Point Numbers Registers for real numbers usually contain 32 or 64 bits, allowing 2 32 or 2 64.
Booth’s Algorithm.
CMPE12cGabriel Hugh Elkaim 1 What do floating-point numbers represent? Rational numbers with non-repeating expansions in the given base within the specified.
COE 308: Computer Architecture (T032) Dr. Marwan Abu-Amara Integer & Floating-Point Arithmetic (cont.) (Appendix A, Computer Architecture: A Quantitative.
Floating Point Numbers
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
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
COE 308: Computer Architecture (T041) Dr. Marwan Abu-Amara Integer & Floating-Point Arithmetic (Appendix A, Computer Architecture: A Quantitative Approach,
Computer ArchitectureFall 2008 © August 27, CS 447 – Computer Architecture Lecture 4 Computer Arithmetic (2)
Binary Representation and Computer Arithmetic
Simple Data Type Representation and conversion of numbers
Computer Arithmetic Nizamettin AYDIN
Computer Arithmetic. Instruction Formats Layout of bits in an instruction Includes opcode Includes (implicit or explicit) operand(s) Usually more than.
Computer Arithmetic.
1 Lecture 5 Floating Point Numbers ITEC 1000 “Introduction to Information Technology”
CEN 316 Computer Organization and Design Computer Arithmetic Floating Point Dr. Mansour AL Zuair.
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Number Systems So far we have studied the following integer number systems in computer Unsigned numbers Sign/magnitude numbers Two’s complement numbers.
Computer Architecture
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.
Fixed and Floating Point Numbers Lesson 3 Ioan Despi.
CSC 221 Computer Organization and Assembly Language
Floating Point Arithmetic
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.
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.
CSPP58001 Floating Point Numbers. CSPP58001 Floating vs. fixed point Floating point refers to a binary decimal representation where there is not a fixed.
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Chapter 3 Arithmetic for Computers. Chapter 3 — Arithmetic for Computers — 2 Arithmetic for Computers Operations on integers Addition and subtraction.
Floating Point Numbers Representation, Operations, and Accuracy CS223 Digital Design.
CS 232: Computer Architecture II Prof. Laxmikant (Sanjay) Kale Floating point arithmetic.
Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001.
Lecture No. 4 Computer Logic Design. Negative Number Representation 3 Options –Sign-magnitude –One’s Complement –Two’s Complement  used in computers.
William Stallings Computer Organization and Architecture 8th Edition
Floating Point Representations
Integer Division.
Floating Point Number system corresponding to the decimal notation
William Stallings Computer Organization and Architecture 7th Edition
CSCI206 - Computer Organization & Programming
Floating Point Arithmetic
How to represent real numbers
ECEG-3202 Computer Architecture and Organization
Floating Point Arithmetic
Presentation transcript:

CMPE12cCyrus Bazeghi 1 What do floating-point numbers represent? Rational numbers with non-repeating expansions in the given base within the specified exponent range. They do not represent repeating rational or irrational numbers, or any number too small or too large. Floating Point Format

CMPE12cCyrus Bazeghi 2 IEEE Double Precision FP IEEE Double Precision is similar to SP –52-bit M 53 bits of precision with hidden bit –11-bit E, excess 1023, representing – –One sign bit Always use DP unless memory/file size is important –SP ~ … –DP ~ … Be very careful of these ranges in numeric computation

CMPE12cCyrus Bazeghi 3 Floating Point Arithmetic Floating Point operations include Addition Subtraction Multiplication Division They are complicated because…

CMPE12cCyrus Bazeghi 4 Floating Point Addition 1.Align decimal points 2.Add 3.Normalize the result Often already normalized Otherwise move one digit x Round result x x x x x x 10 2 Decimal Review How do we do this?

CMPE12cCyrus Bazeghi 5 Floating Point Addition First step: get into SP FP if not already.25 = = Or with hidden bit.25 = = Example: in SP FP Hidden Bit

CMPE12cCyrus Bazeghi 6 Second step: Align radix points –Shifting F left by 1 bit, decreasing e by 1 –Shifting F right by 1 bit, increasing e by 1 –Shift F right so least significant bits fall off –Which of the two numbers should we shift? Floating Point Addition

CMPE12cCyrus Bazeghi 7 Floating Point Addition Shift the.25 to increase its exponent so it matches that of ’s e: – (127) = 100’s e: – (127) = Shift.25 by 8 then. Easier method: Bias cancels with subtraction, so Second step: Align radix points cont ’s E 0.25’s E

CMPE12cCyrus Bazeghi 8 Carefully shifting the 0.25’s fraction S E HB F (original value) (shifted by 1) (shifted by 2) (shifted by 3) (shifted by 4) (shifted by 5) (shifted by 6) (shifted by 7) (shifted by 8) Floating Point Addition

CMPE12cCyrus Bazeghi 9 Floating Point Addition Third Step: Add fractions with hidden bit (100) (.25) Fourth Step: Normalize the result Get a ‘1’ back in hidden bit Already normalized most of the time Remove hidden bit and finished

CMPE12cCyrus Bazeghi 10 Normalization example S E HB F Need to shift so that only a 1 in HB spot > discarded Floating Point Addition

CMPE12cCyrus Bazeghi 11 Floating Point Subtraction Mantissa’s are sign-magnitude Watch out when the numbers are close x x 10 2 A many-digit normalization is possible This is why FP addition is in many ways more difficult than FP multiplication

CMPE12cCyrus Bazeghi 12 Floating Point Subtraction 1.Align radix points 2.Perform sign-magnitude operand swap if needed Compare magnitudes (with hidden bit) Change sign bit if order of operands is changed. 3.Subtract 4.Normalize 5.Round Steps to do subtraction

CMPE12cCyrus Bazeghi 13 S E HB F smaller bigger switch order and make result negative bigger smaller switched sign Floating Point Subtraction Simple Example:

CMPE12cCyrus Bazeghi 14 Floating Point Multiplication 1.Multiply mantissas 3.0 x Add exponents = 3 3. Combine x Normalize if needed 1.50 x 10 4 Decimal example: 3.0 x 10 1 x5.0 x 10 2 How do we do this?

CMPE12cCyrus Bazeghi 15 Floating Point Multiplication Multiplication in binary (4-bit F) x Step 1: Multiply mantissas (put hidden bit back first!!) x

CMPE12cCyrus Bazeghi 16 Floating Point Multiplication Second step: Add exponents, subtract extra bias Third step: Renormalize, correcting exponent Becomes Fourth step: Drop the hidden bit (127)

CMPE12cCyrus Bazeghi 17 Multiply these SP FP numbers together 0x49FC0000 x0x4BE00000 Floating Point Multiplication

CMPE12cCyrus Bazeghi 18 Floating Point Division True division Unsigned, full-precision division on mantissas This is much more costly (e.g. 4x) than mult. Subtract exponents Faster division Newton’s method to find reciprocal Multiply dividend by reciprocal of divisor May not yield exact result without some work Similar speed as multiplication