What is Rounding Error? AiS Challenge STI 2003 Richard Allen.

Slides:



Advertisements
Similar presentations
Roundoff and truncation errors
Advertisements

2009 Spring Errors & Source of Errors SpringBIL108E Errors in Computing Several causes for malfunction in computer systems. –Hardware fails –Critical.
CML CML CS 230: Computer Organization and Assembly Language Aviral Shrivastava Department of Computer Science and Engineering School of Computing and Informatics.
Topics covered: Floating point arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
CSC 4250 Computer Architectures September 12, 2006 Appendix H. Computer Arithmetic.
Scuds and Patriots CSE 200. History 1 st Gulf war 1991 Iraq attacking US troops using Scud missiles US defense: Patriot missiles.
Chapter 8 Representing Information Digitally.
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: November 10, 2004 Lecture Number: 31.
Floating Point Representation in Computers Floating Point Numbers - What are they? Floating Point Representation Floating Point Operations Where Things.
CSC1016 Coursework Clarification Derek Mortimer March 2010.
Round-Off and Truncation Errors
1 CSE1301 Computer Programming Lecture 30: Real Number Representation.
L11 – Floating Point 1 Comp 411 – Fall /21/2009 Floating-Point Arithmetic Reading: Study Chapter 3.5 Skim if ((A + A) - A == A) { SelfDestruct()
CSE1301 Computer Programming Lecture 33: Real Number Representation
Dr Damian Conway Room 132 Building 26
Faculty of Computer Science © 2006 CMPUT 229 Representing Information Numbers, Numbers, and Numbers.
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
1 Error Analysis Part 1 The Basics. 2 Key Concepts Analytical vs. numerical Methods Representation of floating-point numbers Concept of significant digits.
Datorsystem 1 och Datorarkitektur 1 – föreläsning 8 fredag 9 november 2007.
1 Binary Numbers Again Recall that N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to bits.
NEGATIVE BINARY NUMBER – Digital Circuit 1 Choopan Rattanapoka.
February 26, 2003MIPS floating-point arithmetic1 Question  Which of the following are represented by the hexadecimal number 0x ? —the integer.
Fixed point binary numbers. Objectives  Draw a distinction between integers and numbers with a fractional part in a computer context.  Describe how.
2.2 Errors. Why Study Errors First? Nearly all our modeling is done on digital computers (aside: what would a non-digital analog computer look like?)
Numerical Computations in Linear Algebra. Mathematically posed problems that are to be solved, or whose solution is to be confirmed on a digital computer.
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 Design Floating-Point Arithmetic
Chapter 1 Scientific Computing Approximation in Scientific Computing (1.2) January 12, 2010.
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 22, 2004 Lecture Number: 24.
Data Representation in Computer Systems
ME 142 Engineering Computation I Computer Precision & Round-Off Error.
5.2 Errrors. Why Study Errors First? Nearly all our modeling is done on digital computers (aside: what would a non-digital analog computer look like?)
Round-off Errors.
Introduction to error analysis Class II "The purpose of computing is insight, not numbers", R. H. Hamming.
Round-off Errors and Computer Arithmetic. The arithmetic performed by a calculator or computer is different from the arithmetic in algebra and calculus.
BR 8/99 Binary Numbers Again Recall than N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to 255.
CSC 221 Computer Organization and Assembly Language
Floating Point Arithmetic
Lecture 08 – Documentation, debugging.  docstring  A special kind of string (text) used to provide documentation  Appears at the top of a module 
CPS120: Introduction to Computer Science Operations Lecture 9.
“I am not in the office at the moment. Send any work to be translated.”
Lecture 4 - Numerical Errors CVEN 302 June 10, 2002.
TWO EXAMPLES AS MOTIVATION FOR THE STUDY OF COMPUTER ERRORS
1 Approximation. 2 Taylor Series 3 Truncation Error  In general, the nth order Taylor series expansion will be exact for an nth order polynomial  In.
Computers and Numbers. Types of Numbers Computers store two different types of numbers: Whole Numbers AKA Integers (mathematics) AKA Fixed Point Numbers.
Binary Arithmetic.
CMPUT Computer Organization and Architecture I1 CMPUT229 - Fall 2002 Topic1: Numbers, Numbers, and Numbers José Nelson Amaral.
Sources of Computational Errors FLP approximates exact computation with real numbers Two sources of errors to understand and counteract: 1. Representation.
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
Introduction to error analysis Class II "The purpose of computing is insight, not numbers", R. H. Hamming.
COSC2410: LAB 2 BINARY ARITHMETIC SIGNED NUMBERS FLOATING POINT REPRESENTATION BOOLEAN ALGEBRA 1.
Solving Quadratic Equations by Graphing (9-2) Objective: Solve quadratic equations by graphing. Estimate solutions of quadratic equations by graphing.
973cs111_add_posneg.ppt Integers Whole numbers Do NOT contain decimal points (as in money) 43,689 is an integer 43, is NOT an integer (it is floating.
Cosc 2150: Computer Organization Chapter 9, Part 3 Floating point numbers.
Machine arithmetic and associated errors Introduction to error analysis Class II.
CHAPTER 9 COMPUTER ARITHMETIC - ALU
ME 142 Engineering Computation I
New head garb has been ordered
Computer Science 210 Computer Organization
Floating-Point Arithmetic
Floating-Point Arithmetic
Floating Point.
Chapter 2 ERROR ANALYSIS
Computer Science 210 Computer Organization
Introduction to Scientific Computation
Approximations and Round-Off Errors Chapter 3
Data Representation Limitations
Numerical Analysis Lecture 2.
Sources of Error Major: All Engineering Majors
Presentation transcript:

What is Rounding Error? AiS Challenge STI 2003 Richard Allen

What is Rounding Error? As I was going up the stair I met a man who wasn’t there! He wasn’t there again today! I wish, I wish he’d stay away!

Floating-Point Numbers Nearly all computation on a digital computer is done in floating-point arithmetic (FPA). A floating-point number system (FPS) is a number system that uses a finite number of digits to represent the real number system that we use in exact computation. Floating –point numbers are generally represented in binary in a computer.

A Floating-Point Number System Decimal example: A FPS with 1-decimal digit ranging from -9.0 to +9.0; system contains only 55 numbers. 0.0 .01 .02 .03 .04 .05 .06 .07 .08 .09  0.1  0.2  0.3  0.4  0.5  0.6  0.7  0.8  0.9  1.0  2.0  3.0  4.0  5.0  6.0  7.0  8.0  9.0

Rounding Arithmetic If pi = were represented in our 1- digit FPS, it would be 3.0. In a 5-decimal system, pi could be represented by (rounding) (truncation or chopping) Rounding error is the difference between the result in exact arithmetic and the result in our floating-point system.

Some Interesting Implications of Rounding Error Check out the site http: for some interesting examples. Three of these examples follow: The Patriot Down and out in Vancouver I shot an arrow in the air (The sad story of the Ariane 5)

The Patriot During the Gulf War, an Iraqi Scud got through the Patriot anti-missile system and hit a barracks, killing 28 people. To track the Scud, the system had to determine the interval between tracking times by subtracting two values of a timer. The times in tenths of a second were stored as integers (4.2 was stored as 42) in the onboard computer.

The Patriot (cont.) To compute the interval, timer values were con- verted to floating-point representation by multi- plying by has a non-terminating binary expansion; con- sequently, the interval was computed with error - the larger the value, the larger the error. At the time of the incident, the missile battery had been operating for over 100 hrs, resulting in an error of 0.34 sec. in the timer causing the system to look in the wrong place for the incoming Scud.

Down and Out in Vancouver Stock Exchange In 1982 the Vancouver Stock Exchange introduced an index with a nominal value of After each transaction, the index was recomputed and truncated to three decimal places. After 22 months of transactions, the index was The true value was

The sad story of the Ariane 5 On June 4, 1996, Ariane was launched at Kourou and all went well for 36 sec. At second 37, the rocket veered off course and self-destructed. The problem was in the Inertial Reference System.

The sad story of the Ariane 5 The IRS tried to convert a 64-bit floating point number to a 16-bit integer. The number was too large, which triggered an error and send a diagnostic message to the On-Board Computer. The OBC interpreted the diagnostic word as flight data. Finis!

Solution of a Quadratic Equation The solution to the quadratic equation x^2 +b*x + c = 0 is x = [-b +/-sqrt(b^2 – 4*c)]/2 Example: b = , c = e-6, using 6-digit decimal arithmetic r1 = e-1 ( e-1) r2 = e-6 ( e-6)

Quadratic Equation (cont.) r1 looks pretty good, but r2 does not. Why? Cancellation occurred in forming [b – sqrt(b^2 – 4*c)]/2 = [ ]/2 = 2.5e-6 However, death occurred when we formed [b^2 – 4*c] = [ ] = Cancellation and the addition/subtraction of floating-point numbers with differing magnitudes can cause problems.

Quadratic Equation: the cure We must restore the information that we don’t have about the coefficient c. A little algebra will tell us that if r1 and r1 are real, distinct roots of x^2 + b*x + c = 0, then r1*r2 = c So, we compute r1 as before and compute r2 as r2 = c/r1 = e-6 / e-1 = ( e-6)