Introduction to floating point arithmetic
|
|
- Jeffry Rich
- 5 years ago
- Views:
Transcription
1 Introduction to floating point arithmetic Matthias Petschow and Paolo Bientinesi AICES, RWTH Aachen October 24th, 2013 Aachen, Germany Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
2 Disclaimer Muller et al. - Handbook of Floating-Point Arithmetic pages! Many topics not covered in this lecture (e.g., hardware/software implementation of FPA, language support, cleverly using FPA) This lecture: basics of floating point representation and arithmetic Goal: Make you aware of the issues arising in finite precision computations See the references below for a more thorough treatment of the topic Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
3 References Article: What every computer scientist should know about floating-point arithmetic, by David Goldberg Article: Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point Arithmetic, by William Kahan Book: Accuracy and Stability of Numerical Algorithms, by Nick Higham Book: Numerical Computing with IEEE Floating Point Arithmetic, by Michael Overton IEEE and IEEE : Standard for Floating-Point Arithmetic Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
4 Numerical Representation Numbers 123 = (first 40 digits) π = In general: Infinite number of digits Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
5 Numerical Representation Numbers 123 = (first 40 digits) π = In general: Infinite number of digits Computers Finite memory Approximated numbers Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
6 FP representation Floating point system F\{0} ( 1) s d 0.d 1 d 2 d 3... d p 1 β e with base β, precision p, and s {0, 1} d i {0,..., β 1} d 0 0 e min e e max IEEE-754 specifications (β = 2, d 0 = 1) Single: p = 24, e min = 126, e max = 127 Double: p = 53, e min = 1022, e max = 1023 Additionally: ±0, ±, subnormal numbers, NaNs Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
7 IEEE single precision Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
8 IEEE single precision ( 1) s (1 + f) 2 E 127 f = d d d d e = E 127, biased exponent 1 E 254 Special values for E = 0: F = 0 : ±0 F 0 : subnormal numbers with d 0 = 0 and implicit exponent e = 126 Special values for E = 255: F = 0 : ± F 0 : NaNs Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
9 IEEE double precision Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
10 Example questions Question 1 What is the largest finite floating point number is IEEE single precision? Question 2 What is the smallest positive normalized floating point number is IEEE single precision? What is the smallest positive number? Question 3 How many normalized IEEE single precision numbers and how many subnormal numbers are there? Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
11 Example questions Question 4 Given IEEE single/double precision (p = 24, 53), what is the gap between 1 and the next larger number? Question 5 Between an adjacent pair of nonzero IEEE single precision real numbers, how many IEEE double precision numbers are there? Question 6 What is the largest integer u such that all integer in the interval [ u, u] are exactly representable in IEEE single precision format? What is the corresponding u for double precision? Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
12 Representation error Relative rounding error Let x R and x [ω min, ω max ], then x = x(1 + δ) where δ u and x = x/(1 + δ) where δ u with u denoting the unit roundoff. ω min = smallest normalized positive floating point number ω max = largest normalized positive floating point number x = [x] = floating point representation of x If rounded to nearest float, x = RN(x) and u = 2 p For other rounding modes, u = 2 p+1 Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
13 Example questions Task Given a base 2 floating point format with precision p, show that if x R lies in the normalized range than RN(x) = x(1 + δ), with δ 2 p, where RN() rounds to the nearest floating point number. Question What if RN(x) is subnormal? Find an example where the above is not true. Question What if we truncate that is round to zero RZ() instead of rounding to the nearest number RN()? Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
14 Finite precision arithmetic 4-digit representation Inexact Arithmetic = = Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
15 Finite precision arithmetic 4-digit representation Inexact Arithmetic = = Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
16 Finite precision arithmetic 4-digit representation Inexact Arithmetic = = Truncated Rounded Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
17 Finite precision arithmetic 4-digit representation Inexact Arithmetic Associativity? = = Truncated Rounded Exact arithmetic: ( ) = ( ) Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
18 Finite precision arithmetic 4-digit representation Inexact Arithmetic Associativity? = = Truncated Rounded Exact arithmetic: ( ) = ( ) Inexact arithmetic: ( ) = Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
19 Finite precision arithmetic 4-digit representation Inexact Arithmetic Associativity? = = Truncated Rounded No! Exact arithmetic: ( ) = ( ) Inexact arithmetic: ( ) = ( ) = Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
20 IEEE FP arithmetic The standard floating point model Given operation {+,,, /} and x, y F 0, [x y] = RN(x y) = (x y)(1 + δ) with δ u, provided no underflow/overflow occurred. RN() can be replaced by other rounding modes. For RN() we have seen that u = 2 p. Also, (x y)(1 + δ) can be replaced by (x y)/(1 + δ). Similarly, x = RN(x). What about sin(x), cos(x), exp(x), log(x),...? Notation: Assuming a left-to-right evaluation, it holds [ [[x] ] [ ] ] [x + y + z/w] = + [y] + [z]/[w] Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
21 Example questions Question 1 If x is a floating point number, is the floating point product [1 x] equal to x? Question 2 If x 0 is a (finite) floating point number, is the floating point quotient [x/x] equal to 1? Question 3 If x is a floating point number, is the floating point product [0.5 x] equal to floating point quotient [x/2]? Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
22 Example questions Question 4 Is it true that for all a, b R we have [a + b] = [b + a] and [a b] = [b a]? Question 5 Let a = 1, b = 1, and c = In IEEE single precision arithmetic, what are the results of [a + [b + c]] and [[a + b] + c]? Question 6 Let a = b = 2 513, and c = In IEEE double precision arithmetic, what are the results of [a [b c]] and [[a b] c]? Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
23 Example question Question 7 What is the result calling the function fun(2.0,0.0) defined below (using IEEE floating point values)? fun(a, b) { res = 1/(1/a + 1/b) return(res) } Question 8 What is a potential problem of the following program? How can it be fixed? hypot(a, b) { c = a 2 + b 2 c = sqrt(c) return(c) } Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
24 Example questions Task Calculating the roots of a quadratic polynomial with roots() as below can cause inaccurate results (e.g. a = c = 1, b = 10 8 for double precision). Write a code that avoids cancellation as much as possible, e.g. by using r 1 r 2 = c/a. Are there other potential problems, such as overflow etc.? roots(a, b, c) { r 1 = b+ b 2 4ac 2a r 2 = b b 2 4ac 2a return(r 1, r 2 ) } Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
25 Error Analysis f : A B, y = f(x) Es.: f(x) = x 2 + sin(2 x) x = π, f(x) =? 123 Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
26 Error Analysis f : A B, y = f(x) Es.: f(x) = x 2 + sin(2 x) x = π, f(x) =? 123 Exact arithmetic: ( π ) 2 ( + sin 2 π ) =... Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
27 Error Analysis f : A B, y = f(x) Es.: f(x) = x 2 + sin(2 x) x = π, f(x) =? 123 Exact arithmetic: ( π ) 2 ( + sin 2 π ) =... Inexact arithmetic: x ˆx, f ˆf ˆf(ˆx) instead of f(x) Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
28 Example: Dot Product x, y R n ; κ := x T y ( ((χ0 κ := ψ 0 + χ 1 ψ 1 ) + ) ) + χ n 2 ψ n 2 + χ n 1 ψ n 1 ˇκ = = ( ((χ0 ψ 0 (1 + ɛ (0) ) + χ 1 ψ 1 (1 + ɛ (1) ) ) (1 + ɛ (1) ) +χ n 1 ψ n 1 (1 + ɛ (n 1) ) (1 + ɛ (n 1) + ) n 1 i=0 χ i ψ i (1 + ɛ (i) ) n 1 (1 + ɛ (j) j=i + ) + ) + ) (1 + ɛ (n 2) + ) where ɛ (0) + = 0 and ɛ (0), ɛ (j), ɛ (j) + u for j = 1,..., n 1 Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
29 Backward Stability Let f : D R be a map from the domain D to the range R. Let ˆf : D R represent the execution in floating point arithmetic of a given algorithm A that computes f. A is said to be backward stable if for all x D there exists a perturbed input x D, close to x, such that ˆf(x) = f( x). Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
30 Backward Stability Let f : D R be a map from the domain D to the range R. Let ˆf : D R represent the execution in floating point arithmetic of a given algorithm A that computes f. A is said to be backward stable if for all x D there exists a perturbed input x D, close to x, such that ˆf(x) = f( x). I.e., the result computed in floating point arithmetic ( ˆf(x)) equals the result obtained when the mathematically exact function (f) is applied to slightly perturbed data ( x). The difference between x and x, is the perturbation to the original input x. Matthias Petschow (AICES, RWTH Aachen) Floating Point October 24th, / 21
Scientific Computing: An Introductory Survey
Scientific Computing: An Introductory Survey Chapter 1 Scientific Computing Prof. Michael T. Heath Department of Computer Science University of Illinois at Urbana-Champaign Copyright c 2002. Reproduction
More informationComputer Arithmetic. 1. Floating-point representation of numbers (scientific notation) has four components, for example, 3.
ECS231 Handout Computer Arithmetic I: Floating-point numbers and representations 1. Floating-point representation of numbers (scientific notation) has four components, for example, 3.1416 10 1 sign significandbase
More informationScientific Computing: An Introductory Survey
Scientific Computing: An Introductory Survey Chapter 1 Scientific Computing Prof. Michael T. Heath Department of Computer Science University of Illinois at Urbana-Champaign Copyright c 2002. Reproduction
More informationLecture Notes to Accompany. Scientific Computing An Introductory Survey. What is scientific computing?
Lecture Notes to Accompany Scientific Computing An Introductory Survey Second Edition by Michael T. Heath Scientific Computing What is scientific computing? Design and analysis of algorithms for solving
More informationRoundoff Errors and Computer Arithmetic
Jim Lambers Math 105A Summer Session I 2003-04 Lecture 2 Notes These notes correspond to Section 1.2 in the text. Roundoff Errors and Computer Arithmetic In computing the solution to any mathematical problem,
More informationReview Questions 26 CHAPTER 1. SCIENTIFIC COMPUTING
26 CHAPTER 1. SCIENTIFIC COMPUTING amples. The IEEE floating-point standard can be found in [131]. A useful tutorial on floating-point arithmetic and the IEEE standard is [97]. Although it is no substitute
More informationCS321 Introduction To Numerical Methods
CS3 Introduction To Numerical Methods Fuhua (Frank) Cheng Department of Computer Science University of Kentucky Lexington KY 456-46 - - Table of Contents Errors and Number Representations 3 Error Types
More informationComputational Methods. Sources of Errors
Computational Methods Sources of Errors Manfred Huber 2011 1 Numerical Analysis / Scientific Computing Many problems in Science and Engineering can not be solved analytically on a computer Numeric solutions
More informationMAT128A: Numerical Analysis Lecture Two: Finite Precision Arithmetic
MAT128A: Numerical Analysis Lecture Two: Finite Precision Arithmetic September 28, 2018 Lecture 1 September 28, 2018 1 / 25 Floating point arithmetic Computers use finite strings of binary digits to represent
More informationClasses of Real Numbers 1/2. The Real Line
Classes of Real Numbers All real numbers can be represented by a line: 1/2 π 1 0 1 2 3 4 real numbers The Real Line { integers rational numbers non-integral fractions irrational numbers Rational numbers
More informationComputational Economics and Finance
Computational Economics and Finance Part I: Elementary Concepts of Numerical Analysis Spring 2015 Outline Computer arithmetic Error analysis: Sources of error Error propagation Controlling the error Rates
More informationAM205: lecture 2. 1 These have been shifted to MD 323 for the rest of the semester.
AM205: lecture 2 Luna and Gary will hold a Python tutorial on Wednesday in 60 Oxford Street, Room 330 Assignment 1 will be posted this week Chris will hold office hours on Thursday (1:30pm 3:30pm, Pierce
More informationCS321. Introduction to Numerical Methods
CS31 Introduction to Numerical Methods Lecture 1 Number Representations and Errors Professor Jun Zhang Department of Computer Science University of Kentucky Lexington, KY 40506 0633 August 5, 017 Number
More informationBinary floating point encodings
Week 1: Wednesday, Jan 25 Binary floating point encodings Binary floating point arithmetic is essentially scientific notation. Where in decimal scientific notation we write in floating point, we write
More informationFloating-Point Numbers in Digital Computers
POLYTECHNIC UNIVERSITY Department of Computer and Information Science Floating-Point Numbers in Digital Computers K. Ming Leung Abstract: We explain how floating-point numbers are represented and stored
More informationFloating-Point Arithmetic
Floating-Point Arithmetic ECS30 Winter 207 January 27, 207 Floating point numbers Floating-point representation of numbers (scientific notation) has four components, for example, 3.46 0 sign significand
More information2 Computation with Floating-Point Numbers
2 Computation with Floating-Point Numbers 2.1 Floating-Point Representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However, real numbers
More informationFloating-Point Numbers in Digital Computers
POLYTECHNIC UNIVERSITY Department of Computer and Information Science Floating-Point Numbers in Digital Computers K. Ming Leung Abstract: We explain how floating-point numbers are represented and stored
More informationReview of Calculus, cont d
Jim Lambers MAT 460/560 Fall Semester 2009-10 Lecture 4 Notes These notes correspond to Sections 1.1 1.2 in the text. Review of Calculus, cont d Taylor s Theorem, cont d We conclude our discussion of Taylor
More informationComputational Economics and Finance
Computational Economics and Finance Part I: Elementary Concepts of Numerical Analysis Spring 2016 Outline Computer arithmetic Error analysis: Sources of error Error propagation Controlling the error Rates
More informationCHAPTER 2 SENSITIVITY OF LINEAR SYSTEMS; EFFECTS OF ROUNDOFF ERRORS
CHAPTER SENSITIVITY OF LINEAR SYSTEMS; EFFECTS OF ROUNDOFF ERRORS The two main concepts involved here are the condition (of a problem) and the stability (of an algorithm). Both of these concepts deal with
More informationFinite arithmetic and error analysis
Finite arithmetic and error analysis Escuela de Ingeniería Informática de Oviedo (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 1 / 45 Outline 1 Number representation:
More informationIntroduction to Numerical Computing
Statistics 580 Introduction to Numerical Computing Number Systems In the decimal system we use the 10 numeric symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 to represent numbers. The relative position of each symbol
More informationFloating-point representation
Lecture 3-4: Floating-point representation and arithmetic Floating-point representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However,
More informationChapter 3. Errors and numerical stability
Chapter 3 Errors and numerical stability 1 Representation of numbers Binary system : micro-transistor in state off 0 on 1 Smallest amount of stored data bit Object in memory chain of 1 and 0 10011000110101001111010010100010
More informationOutline. 1 Scientific Computing. 2 Approximations. 3 Computer Arithmetic. Scientific Computing Approximations Computer Arithmetic
Outline 1 2 3 Michael T. Heath 2 / 46 Introduction Computational Problems General Strategy What is scientific computing? Design and analysis of algorithms for numerically solving mathematical problems
More information2 Computation with Floating-Point Numbers
2 Computation with Floating-Point Numbers 2.1 Floating-Point Representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However, real numbers
More informationNumerical Computing: An Introduction
Numerical Computing: An Introduction Gyula Horváth Horvath@inf.u-szeged.hu Tom Verhoeff T.Verhoeff@TUE.NL University of Szeged Hungary Eindhoven University of Technology The Netherlands Numerical Computing
More informationFloating Point Representation. CS Summer 2008 Jonathan Kaldor
Floating Point Representation CS3220 - Summer 2008 Jonathan Kaldor Floating Point Numbers Infinite supply of real numbers Requires infinite space to represent certain numbers We need to be able to represent
More informationNumerical Methods 5633
Numerical Methods 5633 Lecture 2 Marina Krstic Marinkovic mmarina@maths.tcd.ie School of Mathematics Trinity College Dublin Marina Krstic Marinkovic 1 / 15 5633-Numerical Methods Organisational Assignment
More informationTable : IEEE Single Format ± a a 2 a 3 :::a 8 b b 2 b 3 :::b 23 If exponent bitstring a :::a 8 is Then numerical value represented is ( ) 2 = (
Floating Point Numbers in Java by Michael L. Overton Virtually all modern computers follow the IEEE 2 floating point standard in their representation of floating point numbers. The Java programming language
More informationMost nonzero floating-point numbers are normalized. This means they can be expressed as. x = ±(1 + f) 2 e. 0 f < 1
Floating-Point Arithmetic Numerical Analysis uses floating-point arithmetic, but it is just one tool in numerical computation. There is an impression that floating point arithmetic is unpredictable and
More informationCS 6210 Fall 2016 Bei Wang. Lecture 4 Floating Point Systems Continued
CS 6210 Fall 2016 Bei Wang Lecture 4 Floating Point Systems Continued Take home message 1. Floating point rounding 2. Rounding unit 3. 64 bit word: double precision (IEEE standard word) 4. Exact rounding
More information2.1.1 Fixed-Point (or Integer) Arithmetic
x = approximation to true value x error = x x, relative error = x x. x 2.1.1 Fixed-Point (or Integer) Arithmetic A base 2 (base 10) fixed-point number has a fixed number of binary (decimal) places. 1.
More informationFloating-Point Arithmetic
Floating-Point Arithmetic 1 Numerical Analysis a definition sources of error 2 Floating-Point Numbers floating-point representation of a real number machine precision 3 Floating-Point Arithmetic adding
More informationSome issues related to double roundings
Some issues related to double roundings Erik Martin-Dorel 1 Guillaume Melquiond 2 Jean-Michel Muller 3 1 ENS Lyon, 2 Inria, 3 CNRS Valencia, June 2012 Martin-Dorel, Melquiond, Muller Some issues related
More informationFloating Point Arithmetic
Floating Point Arithmetic Computer Systems, Section 2.4 Abstraction Anything that is not an integer can be thought of as . e.g. 391.1356 Or can be thought of as + /
More informationFloating-point numbers. Phys 420/580 Lecture 6
Floating-point numbers Phys 420/580 Lecture 6 Random walk CA Activate a single cell at site i = 0 For all subsequent times steps, let the active site wander to i := i ± 1 with equal probability Random
More informationBindel, Fall 2016 Matrix Computations (CS 6210) Notes for
1 Logistics Notes for 2016-09-07 1. We are still at 50. If you are still waiting and are not interested in knowing if a slot frees up, let me know. 2. There is a correction to HW 1, problem 4; the condition
More informationComputer Representation of Numbers and Computer Arithmetic
Computer Representation of Numbers and Computer Arithmetic January 17, 2017 Contents 1 Binary numbers 6 2 Memory 9 3 Characters 12 1 c A. Sandu, 1998-2015. Distribution outside classroom not permitted.
More informationMathematical preliminaries and error analysis
Mathematical preliminaries and error analysis Tsung-Ming Huang Department of Mathematics National Taiwan Normal University, Taiwan August 28, 2011 Outline 1 Round-off errors and computer arithmetic IEEE
More informationfractional quantities are typically represented in computers using floating point format this approach is very much similar to scientific notation
Floating Point Arithmetic fractional quantities are typically represented in computers using floating point format this approach is very much similar to scientific notation for example, fixed point number
More informationComputing Basics. 1 Sources of Error LECTURE NOTES ECO 613/614 FALL 2007 KAREN A. KOPECKY
LECTURE NOTES ECO 613/614 FALL 2007 KAREN A. KOPECKY Computing Basics 1 Sources of Error Numerical solutions to problems differ from their analytical counterparts. Why? The reason for the difference is
More informationFloating-Point Arithmetic
Floating-Point Arithmetic Raymond J. Spiteri Lecture Notes for CMPT 898: Numerical Software University of Saskatchewan January 9, 2013 Objectives Floating-point numbers Floating-point arithmetic Analysis
More informationData Representation Floating Point
Data Representation Floating Point CSCI 2400 / ECE 3217: Computer Architecture Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides via Jason Fritts Today: Floating Point Background:
More informationIntroduction to Computer Programming in Python Dr. William C. Bulko. Data Types
Introduction to Computer Programming in Python Dr William C Bulko Data Types 2017 What is a data type? A data type is the kind of value represented by a constant or stored by a variable So far, you have
More informationFloating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science)
Floating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science) Floating Point Background: Fractional binary numbers IEEE floating point standard: Definition Example and properties
More informationNumerical computing. How computers store real numbers and the problems that result
Numerical computing How computers store real numbers and the problems that result The scientific method Theory: Mathematical equations provide a description or model Experiment Inference from data Test
More informationData Representation Floating Point
Data Representation Floating Point CSCI 2400 / ECE 3217: Computer Architecture Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides via Jason Fritts Today: Floating Point Background:
More informationNumerical Methods I Numerical Computing
Numerical Methods I Numerical Computing Aleksandar Donev Courant Institute, NYU 1 donev@courant.nyu.edu 1 Course G63.2010.001 / G22.2420-001, Fall 2010 September 9th, 2010 A. Donev (Courant Institute)
More informationFloating Point Numbers
Floating Point Floating Point Numbers Mathematical background: tional binary numbers Representation on computers: IEEE floating point standard Rounding, addition, multiplication Kai Shen 1 2 Fractional
More informationFloating Point January 24, 2008
15-213 The course that gives CMU its Zip! Floating Point January 24, 2008 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties class04.ppt 15-213, S 08 Floating
More informationSection 1.4 Mathematics on the Computer: Floating Point Arithmetic
Section 1.4 Mathematics on the Computer: Floating Point Arithmetic Key terms Floating point arithmetic IEE Standard Mantissa Exponent Roundoff error Pitfalls of floating point arithmetic Structuring computations
More informationFloating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754
Floating Point Puzzles Topics Lecture 3B Floating Point IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties For each of the following C expressions, either: Argue that
More informationFloating point numbers in Scilab
Floating point numbers in Scilab Michaël Baudin May 2011 Abstract This document is a small introduction to floating point numbers in Scilab. In the first part, we describe the theory of floating point
More informationChapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation
Chapter 2 Float Point Arithmetic Topics IEEE Floating Point Standard Fractional Binary Numbers Rounding Floating Point Operations Mathematical properties Real Numbers in Decimal Notation Representation
More informationFloating point. Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties. Next time. !
Floating point Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties Next time! The machine model Chris Riesbeck, Fall 2011 Checkpoint IEEE Floating point Floating
More informationFloating Point Representation in Computers
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
More information1.2 Round-off Errors and Computer Arithmetic
1.2 Round-off Errors and Computer Arithmetic 1 In a computer model, a memory storage unit word is used to store a number. A word has only a finite number of bits. These facts imply: 1. Only a small set
More informationSystem Programming CISC 360. Floating Point September 16, 2008
System Programming CISC 360 Floating Point September 16, 2008 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Powerpoint Lecture Notes for Computer Systems:
More informationME 261: Numerical Analysis. ME 261: Numerical Analysis
ME 261: Numerical Analysis 3. credit hours Prereq.: ME 163/ME 171 Course content Approximations and error types Roots of polynomials and transcendental equations Determinants and matrices Solution of linear
More information8. Floating-point Numbers II
Floating-point Number Systems A Floating-point number system is defined by the four natural numbers: 8. Floating-point Numbers II Floating-point Number Systems; IEEE Standard; Limits of Floating-point
More informationFloating Point Numbers
Floating Point Numbers Computer Systems Organization (Spring 2016) CSCI-UA 201, Section 2 Instructor: Joanna Klukowska Slides adapted from Randal E. Bryant and David R. O Hallaron (CMU) Mohamed Zahran
More informationFloating Point Numbers
Floating Point Numbers Computer Systems Organization (Spring 2016) CSCI-UA 201, Section 2 Fractions in Binary Instructor: Joanna Klukowska Slides adapted from Randal E. Bryant and David R. O Hallaron (CMU)
More informationSystems I. Floating Point. Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties
Systems I Floating Point Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties IEEE Floating Point IEEE Standard 754 Established in 1985 as uniform standard for
More informationComputational Mathematics: Models, Methods and Analysis. Zhilin Li
Computational Mathematics: Models, Methods and Analysis Zhilin Li Chapter 1 Introduction Why is this course important (motivations)? What is the role of this class in the problem solving process using
More informationComputer Systems C S Cynthia Lee
Computer Systems C S 1 0 7 Cynthia Lee 2 Today s Topics LECTURE: Floating point! Real Numbers and Approximation MATH TIME! Some preliminary observations on approximation We know that some non-integer numbers
More informationGiving credit where credit is due
CSCE 230J Computer Organization Floating Point Dr. Steve Goddard goddard@cse.unl.edu http://cse.unl.edu/~goddard/courses/csce230j Giving credit where credit is due Most of slides for this lecture are based
More informationFloating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754
Floating Point Puzzles Topics Lecture 3B Floating Point IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties For each of the following C expressions, either: Argue that
More informationGiving credit where credit is due
JDEP 284H Foundations of Computer Systems Floating Point Dr. Steve Goddard goddard@cse.unl.edu Giving credit where credit is due Most of slides for this lecture are based on slides created by Drs. Bryant
More informationAccuracy versus precision
Accuracy versus precision Accuracy is a consistent error from the true value, but not necessarily a good or precise error Precision is a consistent result within a small error, but not necessarily anywhere
More informationTruncation Errors. Applied Numerical Methods with MATLAB for Engineers and Scientists, 2nd ed., Steven C. Chapra, McGraw Hill, 2008, Ch. 4.
Chapter 4: Roundoff and Truncation Errors Applied Numerical Methods with MATLAB for Engineers and Scientists, 2nd ed., Steven C. Chapra, McGraw Hill, 2008, Ch. 4. 1 Outline Errors Accuracy and Precision
More informationComputer arithmetics: integers, binary floating-point, and decimal floating-point
n!= 0 && -n == n z+1 == z Computer arithmetics: integers, binary floating-point, and decimal floating-point v+w-w!= v x+1 < x Peter Sestoft 2010-02-16 y!= y p == n && 1/p!= 1/n 1 Computer arithmetics Computer
More informationOn the definition of ulp (x)
On the definition of ulp (x) Jean-Michel Muller CNRS Laboratoire LIP, projet Arenaire (CNRS, ENS Lyon, INRIA, Univ. Lyon ), 46 Allée d Italie, 69364 Lyon Cedex 07, France Function ulp (acronym for unit
More informationAMTH142 Lecture 10. Scilab Graphs Floating Point Arithmetic
AMTH142 Lecture 1 Scilab Graphs Floating Point Arithmetic April 2, 27 Contents 1.1 Graphs in Scilab......................... 2 1.1.1 Simple Graphs...................... 2 1.1.2 Line Styles........................
More informationRepresenting and Manipulating Floating Points. Jo, Heeseung
Representing and Manipulating Floating Points Jo, Heeseung The Problem How to represent fractional values with finite number of bits? 0.1 0.612 3.14159265358979323846264338327950288... 2 Fractional Binary
More informationWhat we need to know about error: Class Outline. Computational Methods CMSC/AMSC/MAPL 460. Errors in data and computation
Class Outline Computational Methods CMSC/AMSC/MAPL 460 Errors in data and computation Representing numbers in floating point Ramani Duraiswami, Dept. of Computer Science Computations should be as accurate
More informationFloating point. Today. IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time.
Floating point Today IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time The machine model Fabián E. Bustamante, Spring 2010 IEEE Floating point Floating point
More informationObjectives. look at floating point representation in its basic form expose errors of a different form: rounding error highlight IEEE-754 standard
Floating Point Objectives look at floating point representation in its basic form expose errors of a different form: rounding error highlight IEEE-754 standard 1 Why this is important: Errors come in two
More informationBryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition. Carnegie Mellon
Carnegie Mellon Floating Point 15-213/18-213/14-513/15-513: Introduction to Computer Systems 4 th Lecture, Sept. 6, 2018 Today: Floating Point Background: Fractional binary numbers IEEE floating point
More information(Refer Slide Time: 02:59)
Numerical Methods and Programming P. B. Sunil Kumar Department of Physics Indian Institute of Technology, Madras Lecture - 7 Error propagation and stability Last class we discussed about the representation
More information1.3 Floating Point Form
Section 1.3 Floating Point Form 29 1.3 Floating Point Form Floating point numbers are used by computers to approximate real numbers. On the surface, the question is a simple one. There are an infinite
More informationComputational Methods CMSC/AMSC/MAPL 460. Representing numbers in floating point and associated issues. Ramani Duraiswami, Dept. of Computer Science
Computational Methods CMSC/AMSC/MAPL 460 Representing numbers in floating point and associated issues Ramani Duraiswami, Dept. of Computer Science Class Outline Computations should be as accurate and as
More informationRepresenting and Manipulating Floating Points
Representing and Manipulating Floating Points Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu The Problem How to represent fractional values with
More informationFloating-point operations I
Floating-point operations I The science of floating-point arithmetics IEEE standard Reference What every computer scientist should know about floating-point arithmetic, ACM computing survey, 1991 Chih-Jen
More informationCHAPTER 5 Computer Arithmetic and Round-Off Errors
CHAPTER 5 Computer Arithmetic and Round-Off Errors In the two previous chapters we have seen how numbers can be represented in the binary numeral system and how this is the basis for representing numbers
More informationFloating Point. The World is Not Just Integers. Programming languages support numbers with fraction
1 Floating Point The World is Not Just Integers Programming languages support numbers with fraction Called floating-point numbers Examples: 3.14159265 (π) 2.71828 (e) 0.000000001 or 1.0 10 9 (seconds in
More informationThe Sign consists of a single bit. If this bit is '1', then the number is negative. If this bit is '0', then the number is positive.
IEEE 754 Standard - Overview Frozen Content Modified by on 13-Sep-2017 Before discussing the actual WB_FPU - Wishbone Floating Point Unit peripheral in detail, it is worth spending some time to look at
More informationPrinciples of Scientific Computing Sources of Error
Principles of Scientific Computing Sources of Error Jonathan Goodman last revised January 6, 2006 1 In scientific computing, we never expect to get the exact answer. Inexactness is practically the definition
More informationFloating Point : Introduction to Computer Systems 4 th Lecture, May 25, Instructor: Brian Railing. Carnegie Mellon
Floating Point 15-213: Introduction to Computer Systems 4 th Lecture, May 25, 2018 Instructor: Brian Railing Today: Floating Point Background: Fractional binary numbers IEEE floating point standard: Definition
More informationComputer arithmetics: integers, binary floating-point, and decimal floating-point
z+1 == z Computer arithmetics: integers, binary floating-point, and decimal floating-point Peter Sestoft 2013-02-18** x+1 < x p == n && 1/p!= 1/n 1 Computer arithmetics Computer numbers are cleverly designed,
More informationNatural Numbers and Integers. Big Ideas in Numerical Methods. Overflow. Real Numbers 29/07/2011. Taking some ideas from NM course a little further
Natural Numbers and Integers Big Ideas in Numerical Methods MEI Conference 2011 Natural numbers can be in the range [0, 2 32 1]. These are known in computing as unsigned int. Numbers in the range [ (2
More informationRepresenting and Manipulating Floating Points
Representing and Manipulating Floating Points Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu The Problem How to represent fractional values with
More informationIntroduction to Programming
Introduction to Programming Department of Computer Science and Information Systems Tingting Han (afternoon), Steve Maybank (evening) tingting@dcs.bbk.ac.uk sjmaybank@dcs.bbk.ac.uk Autumn 2017 Week 4: More
More informationMeasuring Improvement When Using HUB Formats to Implement Floating-Point Systems under Round-to- Nearest
Measuring Improvement When Using HUB Formats to Implement Floating-Point Systems under Round-to- Nearest Abstract: This paper analyzes the benefits of using half-unitbiased (HUB) formats to implement floatingpoint
More informationMath 340 Fall 2014, Victor Matveev. Binary system, round-off errors, loss of significance, and double precision accuracy.
Math 340 Fall 2014, Victor Matveev Binary system, round-off errors, loss of significance, and double precision accuracy. 1. Bits and the binary number system A bit is one digit in a binary representation
More informationComputing Fundamentals
Computing Fundamentals Salvatore Filippone salvatore.filippone@uniroma2.it 2012 2013 (salvatore.filippone@uniroma2.it) Computing Fundamentals 2012 2013 1 / 18 Octave basics Octave/Matlab: f p r i n t f
More informationEE878 Special Topics in VLSI. Computer Arithmetic for Digital Signal Processing
EE878 Special Topics in VLSI Computer Arithmetic for Digital Signal Processing Part 4-B Floating-Point Arithmetic - II Spring 2017 Koren Part.4b.1 The IEEE Floating-Point Standard Four formats for floating-point
More informationFloating-point representations
Lecture 10 Floating-point representations Methods of representing real numbers (1) 1. Fixed-point number system limited range and/or limited precision results must be scaled 100101010 1111010 100101010.1111010
More informationFloating-point representations
Lecture 10 Floating-point representations Methods of representing real numbers (1) 1. Fixed-point number system limited range and/or limited precision results must be scaled 100101010 1111010 100101010.1111010
More information