2009 Spring Errors & Source of Errors. 2009 SpringBIL108E Errors in Computing Several causes for malfunction in computer systems. –Hardware fails –Critical.

Slides:



Advertisements
Similar presentations
Part 1 Chapter 4 Roundoff and Truncation Errors PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The McGraw-Hill.
Advertisements

Roundoff and truncation errors
Types and Arithmetic Operators
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Topics covered: Floating point arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
ECIV 201 Computational Methods for Civil Engineers Richard P. Ray, Ph.D., P.E. Error Analysis.
Round-Off and Truncation Errors
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 3 Approximations and Errors.
2-1 Computer Organization Part Fixed Point Numbers Using only two digits of precision for signed base 10 numbers, the range (interval between lowest.
1 Error Analysis Part 1 The Basics. 2 Key Concepts Analytical vs. numerical Methods Representation of floating-point numbers Concept of significant digits.
Floating Point Numbers
Computer Science 210 Computer Organization Floating Point Representation.
The Binary Number System
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 31.
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.
Information Representation (Level ISA3) Floating point numbers.
Numeric precision in SAS. Two aspects of numeric data in SAS The first is how numeric data are stored (how a number is represented in the computer). –
Computer Arithmetic Programming in C++ Computer Science Dept Va Tech August, 2000 © Barnette ND, McQuain WD, Keenan MA 1 Independent Representation.
Computer Science 111 Fundamentals of Programming I Number Systems.
IT253: Computer Organization
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 22, 2004 Lecture Number: 24.
Lecture 2 Number Representation and accuracy
College of Engineering Representing Numbers in a Computer Section B, Spring 2003 COE1361: Computing for Engineers COE1361: Computing for Engineers 1 COE1361:
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
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?)
Representing numbers and Basic MATLAB 1. Representing numbers  numbers used by computers do not behave the same as numbers used in mathematics  e.g.,
Round-off Errors.
Round-off Errors and Computer Arithmetic. The arithmetic performed by a calculator or computer is different from the arithmetic in algebra and calculus.
16. Binary Numbers Programming in C++ Computer Science Dept Va Tech August, 1999 © Barnette ND, McQuain WD, Keenan MA 1 Binary Number System Base.
Floating Point Arithmetic
MECN 3500 Inter - Bayamon Lecture 3 Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
CSPP58001 Floating Point Numbers. CSPP58001 Floating vs. fixed point Floating point refers to a binary decimal representation where there is not a fixed.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 3.
Lecture 4 - Numerical Errors CVEN 302 June 10, 2002.
CS1Q Computer Systems Lecture 2 Simon Gay. Lecture 2CS1Q Computer Systems - Simon Gay2 Binary Numbers We’ll look at some details of the representation.
Binary Arithmetic.
Errors in Numerical Methods
ESO 208A/ESO 218 LECTURE 2 JULY 31, ERRORS MODELING OUTPUTS QUANTIFICATION TRUE VALUE APPROXIMATE VALUE.
Module 2.2 Errors 03/08/2011. Sources of errors Data errors Modeling Implementation errors Absolute and relative errors Round off errors Overflow and.
Cosc 2150: Computer Organization Chapter 9, Part 3 Floating point numbers.
Chapter 2 Errors in Numerical Methods and Their Impacts.
Floating Point Numbers
Floating Point Numbers
Introduction to Numerical Analysis I
Floating Point Representations
Department of Computer Science Georgia State University
Fundamentals of Computer Science
Machine arithmetic and associated errors Introduction to error analysis Class II.
Backgrounder: Binary Math
Binary Numbers The arithmetic used by computers differs in some ways from that used by people. Computers perform operations on numbers with finite and.
ME 142 Engineering Computation I
Number Systems and Binary Arithmetic
Floating Point Numbers: x 10-18
Chapter 6 Floating Point
Chapter 2 ERROR ANALYSIS
Recall our hypothetical computer Marc-32
Roundoff and Truncation Errors
CSCI206 - Computer Organization & Programming
Floating Point Representation
(Part 3-Floating Point Arithmetic)
Approximations and Round-Off Errors Chapter 3
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
Chapter 1 / Error in Numerical Method
Roundoff and Truncation Errors
Floating Point Binary Part 1
Presentation transcript:

2009 Spring Errors & Source of Errors

2009 SpringBIL108E Errors in Computing Several causes for malfunction in computer systems. –Hardware fails –Critical data entered incorrectly –Software errors Bugs Roundoff Truncation Particular to numerical computation unavoidable

2009 SpringBIL108E Numbers on Computers The way in which the numbers are presented in the computer is a source of an error. >> 1 - 5*0.2 ans = 0 >> ans = e-017 What is going on here ?

2009 SpringBIL108E Numbers on Computers Computers use a fixed number of digits to represent a number Numerical values stored in computer has finite precision Increasing the speed of numerical calculations Reducing memory required to store numbers  Introducing roundoff error Should be looked how numbers are stored in computers

2009 SpringBIL108E Bits, Bytes, and Words Modern computers manipulate binary numbers (Base 2) –Bit: Binary digit – 1 or 0 –Byte: Group of eight bits base 10 conversion base = = = = = = =

2009 SpringBIL108E Type of Numbers Three basic types of numbers: –Integers 14 –Real numbers π –Complex numbers2 + 3i For calculations on computer –Numerical values represented by symbols must be stored in computer memory Requires translation –symbolic format (manipulate with pencil & paper) –numeric format (represented by sequences of bits)

2009 SpringBIL108E Type of Numbers Translation is constrained by number of bytes available to store each type of number. Corresponding to IntegersIntegers limited range of values Real Floating-point numbers limited range & number of decimal digits ComplexPairs of floating-point numbers ″

2009 SpringBIL108E Digital Storage of Integers Integers can be exactly represented by base 2 Typical size is 16 bits (2 bytes) 2 16 = is largest 16 bit integer [-32768, 32767] is range of 16 bit integers 32 bit and larger integers are available MATLAB does not use integer variables Prelude for discussing floating-point numbers Note: All standard mathematical calculations in Matlab use floating point numbers.

2009 SpringBIL108E Digital Storage of Floating-Point Numbers Numeric values with non-zero fractional parts are stored as “floating point numbers”. Floating point numbers are stored in a binary equivalent of scientific notation. All floating point values are represented with a “normalized scientific notation”. Example: = x 10 2 Mantissa Exponent

2009 SpringBIL108E Digital Storage of Floating-Point Numbers Floating-point numbers are stored as –32-bit values for single precision –64-bit values for double precision Floating point values have a fixed number of bits allocated for storage of the mantissa and a fixed number of bits allocated for storage of the exponent. Bits for PrecisionSignMantissaExponent Single1238 Double15211

2009 SpringBIL108E Limiting the number of bits allocated for storage of the exponent →upper and lower limits on the “range” (magnitude) of floating point numbers Limiting the number of bits allocated for storage of the mantissa →limit on the “precision” (number of significant digits) for any floating point number. Consequences

2009 SpringBIL108E MATLAB allows numeric variables to be created as 8-bit integers or double-precision floating-point values. Most real numbers cannot be stored exactly (they do not exist on the floating-point number line) Floating-Point Number Line Limitations of 64-bit floating-point values:

2009 SpringBIL108E Compare floating point numbers to real numbers. Range –Real numbers: Infinite; arbitrarily large and arbitrarily small real numbers exist. –Floating point numbers: Finite; the number of bits allocated to the exponent limit the magnitude of floating point values. Precision –Real numbers: Infinite; there is an infinite set of real numbers between any two real numbers. –Floating point numbers: Finite; there is a finite number (perhaps zero) of floating point values between any two floating point values. !!! Floating-point number line is a subset of the real number line !!! Floating-Point Number Line

2009 SpringBIL108E Roundoff Errors in Computing Computers retain a fixed number of significant figures –e, π, √7 cannot expressed by fixed number of sig. figures Base 2 representations –cannot precisely represent exact base 10 numbers Discrepancy introduced by omission of significant figures called “roundoff error” Effects of roundoff accumulate slowly Roundoff errors are inevitable, –solution is to create better algorithms Subtracting nearly equal may lead to severe loss of precision

2009 SpringBIL108E Two rounding errors are made: (1) during computation and storage of u (2) during computation and storage of v Fortuitously, the combination of rounding errors produces the exact result. Roundoff Errors in Computing

2009 SpringBIL108E In exact arithmetic, value of y should be zero. Roundoff error occurs when x is stored. 29/1300 cannot expressed with finite sum of powers of ½. Numerical value stored in x is an approximation to 29/1300. When y is computed, 1300*x evaluates to number slightly different than 29 Bits lost in computation & storage of x are not recoverable. Roundoff Errors in Computing

2009 SpringBIL108E Truncation Errors Results from approximating continuous mathematical expressions with discrete, algebraic formulas. Consider the series for sin(x) sin(x) = x – x3/3! + x5/5! – x7/7! · · · The sine function is defined as infinite series For small x, only a few terms are needed to get good approximation to sin(x). The · · · terms are “truncated”. f true = f sum + truncation error Different than roundoff error, it is under control of user. Truncation error can be reduced by selecting more accurate discrete approximations.

2009 SpringBIL108E Absolute and Relative Errors Floating point comparisons should test for “close enough” instead of exact “equality” –Don’t ask “is x equal to y” –Instead ask, “are x and y ‘close enough’ in value “Close enough” can be measured with either absolute difference or relative difference –Absolute error E abs = ê – e –Relative error E rel = (ê – e) / e = E abs / e where e = some exact or reference value ê = some computed value

2009 SpringBIL108E Precision & Accuracy Precision The smallest difference that can be represented on the computer (help eps) Accuracy How close your answer to the “actual” or “real” answer Good Accuracy Good Precision Good Precision Poor Accuracy Good Accuracy Poor Precision Poor Accuracy Poor Precision Low precision:  = 3.14 High precision:  = Low accuracy:  = High accuracy:  = High accuracy & precision:  =