Floating-Point Representation We can store integers and characters easily in binary, but what about fractions? ¼ =.25 = 2.5 * 10 -1 9.1093897 * 10 -31.

Slides:



Advertisements
Similar presentations
Lecture 11 Oct 12 Circuits for floating-point operations addition multiplication division (only sketchy)
Advertisements

Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Lecture 16: Computer Arithmetic Today’s topic –Floating point numbers –IEEE 754 representations –FP arithmetic Reminder –HW 4 due Monday 1.
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.
Faculty of Computer Science © 2006 CMPUT 229 Floating Point Representation Operating with Real 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)
Floating Point Numbers
Computer ArchitectureFall 2007 © September 5, 2007 Karem Sakallah CS 447 – Computer Architecture.
Floating Point Numbers
1 Module 2: Floating-Point Representation. 2 Floating Point Numbers ■ Significant x base exponent ■ Example:
Floating Point Numbers
ECEN 248 Integer Multiplication, Number Format Adopted from Copyright 2002 David H. Albonesi and the University of Rochester.
Computer ArchitectureFall 2008 © August 27, CS 447 – Computer Architecture Lecture 4 Computer Arithmetic (2)
CPS Computer Architecture Assignment 4: Multiplication, Division, Floating Point.
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
IT 251 Computer Organization and Architecture Introduction to Floating Point Numbers Chia-Chi Teng.
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
Computer Organization and Architecture Computer Arithmetic Chapter 9.
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.
Number Systems II Prepared by Dr P Marais (Modified by D Burford)
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.
Fixed-Point Arithmetics: Part II
Number Systems So far we have studied the following integer number systems in computer Unsigned numbers Sign/magnitude numbers Two’s complement numbers.
ECE232: Hardware Organization and Design
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 10 Department of Computer Science and Software Engineering University of.
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
S. Rawat I.I.T. Kanpur. Floating-point representation IEEE numbers are stored using a kind of scientific notation. ± mantissa * 2 exponent We can represent.
Floating Point (a brief look) We need a way to represent –numbers with fractions, e.g., –very small numbers, e.g., –very large numbers,
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /14/2013 Lecture 16: Floating Point Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE.
Computer Science Engineering B.E.(4 th sem) c omputer system organization Topic-Floating and decimal arithmetic S ubmitted to– Prof. Shweta Agrawal Submitted.
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
Lecture 9: Floating Point
CSC 221 Computer Organization and Assembly Language
COMP201 Computer Systems Floating Point Numbers. Floating Point Numbers  Representations considered so far have a limited range dependent on the number.
Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Monday, January 14 Homework #1 is posted on the website Homework #1 is posted on the website Due before class, Jan. 16 Due before class, Jan. 16.
IT11004: Data Representation and Organization Floating Point Representation.
CSE 340 Simulation Modeling | MUSHFIQUR ROUF CSE340:
CS 232: Computer Architecture II Prof. Laxmikant (Sanjay) Kale Floating point arithmetic.
10/7/2004Comp 120 Fall October 7 Read 5.1 through 5.3 Register! Questions? Chapter 4 – Floating Point.
Adding & Subtracting in Scientific Notation Exponents are SAME 1.) If exponents same, add or subtract the coefficients and keep the power of 10. Examples:
Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001.
Chapter 9 Computer Arithmetic
William Stallings Computer Organization and Architecture 8th Edition
Topics IEEE Floating Point Standard Rounding Floating Point Operations
Floating Point Number system corresponding to the decimal notation
CS 232: Computer Architecture II
William Stallings Computer Organization and Architecture 7th Edition
Outline Introduction Floating Point Arithmetic Adder Multiplier.
Data Structures Mohammed Thajeel To the second year students
ECEG-3202 Computer Architecture and Organization
Chapter 8 Computer Arithmetic
Presentation transcript:

Floating-Point Representation We can store integers and characters easily in binary, but what about fractions? ¼ =.25 = 2.5 * * – m e- - mass of an electron * – e – charge of an electron * – h – plank’s constant What are the components of the above #’s?

Moving to Binary * – m e- - mass of an electron What would the equivalent be in binary? ___________ SignExponentSignificand Single Precision 1 bit8 bits23 bits Double Precision 1 bit11 bits52 bits

Interpreting Floating-point = 9 + 4*.1 + 7* *.001 The i th bit to the right of the decimal point of a decimal number represents______ The i th bit to the right of the decimal point of a binary number represents _______

Translating to Binary 1.Translate left of decimal normally 2.Translate the right of the decimal a.bit-by-bit *or* b.Express as fraction, x/ 2 y, and place x in y bits, filling to the left with 0’s. 3.Multiply by 2 y to move decimal to proper position.

Example 1 – Translate the 7.75 = -1/4 = ¼ =

following numbers into binary fp SignExpSignificand

Bias Notation Problem: Negative exponents have larger value than positive exponents Solution: –Adjust exponent range –add ____ to all exponents

SignExpSignificand … … … … /4 1/ /4 1/4 No Bias Bias

Floating-Point Addition How do we do decimal floating-point? Is it the same as integer addition? /8

Steps to floating-point addition 1.Right-shift _________ of smaller exponent until exponents match 2.Add the __________ 3.______ to adjust decimal point 4.Round the result to fit into the significand

Example 1: ¾ two * two * 2 -1

Example 2: 1.1 two * two * 2 2

Associative property (a + b) + c a + (b + c)

a + (b + c) 1.1 two * two * two * 2 2

(a + b) + c (1.1 two * two * 2 2 ) two * 2 2

Multiplication two * 2 2 * 1.1 two * 2 -2

Multiplication 1.________ exponents 2.________ significands 3.________ decimal point 4.________ answer 5.determine the _______

What about bias notation? two * * 1.1 two *

Thought question Some computers have separate fp and integer register files Most instructions access only int or fp, not both. How is this different from doubling the size of the register file? What are the advantages? Disadvantages?

Thought question

Summary Floating-point greatly increases range of numbers stored in machine. Floating-point representation has limited precision – can not store every number in range. FP arithmetic sometimes rounds answers, violating algebraic properties. FP arithmetic is much slower than integer arithmetic.