Floating Point Representation in Computers Floating Point Numbers - What are they? Floating Point Representation Floating Point Operations Where Things.

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.
1 Binghamton University Floating Point CS220 Computer Systems II 3rd Lecture.
Topics covered: Floating point arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
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
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.
Number Systems Standard positional representation of numbers:
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.
1 Module 2: Floating-Point Representation. 2 Floating Point Numbers ■ Significant x base exponent ■ Example:
Floating Point Numbers
FLOATING POINT COMPUTER ARCHITECTURE AND ORGANIZATION.
Numbers and number systems
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.
Fixed-Point Arithmetics: Part II
Computing Systems Basic arithmetic for computers.
ECE232: Hardware Organization and Design
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
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,
Fixed and Floating Point Numbers Lesson 3 Ioan Despi.
HW 3 Due 3/9 (Mon) 11:00 AM Probs. 2.81, 2.87, 2.88.
CSC 221 Computer Organization and Assembly Language
Floating Point Arithmetic
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 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.
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.
Floating Point Carnegie Mellon /18-243: Introduction to Computer Systems 4 th Lecture, 26 May 2011 Instructors: Gregory Kesden.
Binary Numbers The arithmetic used by computers differs in some ways from that used by people. Computers perform operations on numbers with finite and.
Module 2.2 Errors 03/08/2011. Sources of errors Data errors Modeling Implementation errors Absolute and relative errors Round off errors Overflow and.
COSC2410: LAB 2 BINARY ARITHMETIC SIGNED NUMBERS FLOATING POINT REPRESENTATION BOOLEAN ALGEBRA 1.
Cosc 2150: Computer Organization Chapter 9, Part 3 Floating point numbers.
Floating Point Representations
Floating Point Numbers
CS 105 “Tour of the Black Holes of Computing!”
Binary Numbers The arithmetic used by computers differs in some ways from that used by people. Computers perform operations on numbers with finite and.
Integer Division.
Lecture 9: Floating Point
Topics IEEE Floating Point Standard Rounding Floating Point Operations
Floating Point Numbers: x 10-18
Floating Point Number system corresponding to the decimal notation
CS 232: Computer Architecture II
CS 367 Floating Point Topics (Ch 2.4) IEEE Floating Point Standard
Topic 3d Representation of Real Numbers
Luddy Harrison CS433G Spring 2007
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
CS213 Floating Point Topics IEEE Floating Point Standard Rounding
Topic 3d Representation of Real Numbers
UNIVERSITY OF MASSACHUSETTS Dept
CS 105 “Tour of the Black Holes of Computing!”
Number Representations
Presentation transcript:

Floating Point Representation in Computers Floating Point Numbers - What are they? Floating Point Representation Floating Point Operations Where Things can go wrong

What are Floating Point Numbers? Any Number that cannot be completely described using an Integer number. 1, 2, 523. not a floating point number 1.02, e, 0.1. a floating point number Floating Point numbers are at their best when describing a continuous variable. Floating Point numbers are at their worst when describing discrete values.

Floating Point Number Representation. Floating Point numbers constist of a signed significand (C) and a signed integer exponent(Q) of the base(B). Most commonly represented according to the IEEE 754 Standard. SignificandExponentBase

Floating Point Number Representation. Decimal notation is the sum of fractional powers of 10. Computers store values as the sum of fractional powers of 2.

Floating Point Number Representation. Some decimal numbers have no exact representation in base 2 The significand inifinitely repeats 1100 pattern. Rounded results in a value not quite 0.1

IEEE 754 Types A IEEE 754 float can represent a range of finite numbers, +∞, -∞, and NaN. The range of finite numbers is determined by the properties of the representation. The range of non- zero magnitudes representable is from 1xB^(Emin - p + 1) to (B^p - 1)^(Emax - p + 1).

IEEE 754 types Representable non-zero numbers are split in to two categories, Normal and Subnormal. The smallest magnitude Normal number is B^Emin. Subnormal numbers are number who's magnitude is less then B^Emin. Subnormal numbers allow for underflow exceptions to fail gracefully, getting smaller with loss of precision instead of snapping to zero.

Floating Point Rounding Rounding occurs when the exact result of an operation requires more precision then available in the significand. IEEE 754 Round off modes. round to nearest, where ties round to the nearest even digit in the required position. round to nearest, where ties round away from zero round towards +∞ round towards -∞ round towards zero

Floating Point Operations To Add or Subtract shift numbers left or right so that both have the same exponent, added, and the result is rounded and normalized. e=5; s= ( ) + e=2; s= ( ) e=5; s= e=5; s= (after shifting) e=5; s= (true sum: ) e=5; s= (after rounding)

e=5; s= e=−3; s= ###################################### e=5; s= e=5; s= (after shifting) e=5; s= (true sum) e=5; s= (after rounding/normalization) Floating Point Operations In extreme cases, the sum of two non-zero numbers may be equal to one of them.

Floating Point Operations Catastrophic cancellation can result from the loss of precision when two close numbers are subtracted. e=5; s= − e=5; s= e=5; s= e=−1; s= (after rounding/normalization)

Floating Point Operations To multiply, the significands are multiplied while the exponents are added, and the result is rounded and normalized. e=3; s= × e=5; s= e=8; s= (true product) e=8; s= (after rounding) e=9; s= (after normalization)

Floating Point Problems Floating point addition and multiplication are not necessarily associative. That is (a + b) + c is not necessarily equal to a + (b + c) (a) (b) ____________ rounds to (a + b) (c) ____________ rounds to a + (b + c): (b) (c) ____________ (b + c) (a) ____________ rounds to

Floating Point Problems Floating point addition and multiplication are not necessarily distributive. That is, (a + b) ×c may not be the same as a×c + b×c × = × = = but = × =

Floating Point Problems Cancellation: subtraction of nearly equal operands may cause extreme loss of accuracy. Conversions to integer are not intuitive: converting (63.0/9.0) to integer yields 7, but converting (0.63/0.09) may yield 6. This is because conversions generally truncate rather than round. Floor and ceiling functions may produce results which are off by one from the intuitively expected value.

Floating Point Problems Limited exponent range: results might overflow yielding infinity, or underflow yielding a subnormal number or zero.