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?)

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.
Fixed Point Numbers The binary integer arithmetic you are used to is known by the more general term of Fixed Point arithmetic. Fixed Point means that we.
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
CENG536 Computer Engineering department Çankaya University.
Topics covered: Floating point arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
2-1 Chapter 2 - Data Representation Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer Architecture.
Chapter 2: Data Representation
Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 2: Data Representation.
Chapter 8 Representing Information Digitally.
Floating Point Representation in Computers Floating Point Numbers - What are they? Floating Point Representation Floating Point Operations Where Things.
Datorteknik FloatingPoint bild 1 Floating point Number system corresponding to the decimal notation 1,837 * 10 significand exponent a great number of corresponding.
ECIV 201 Computational Methods for Civil Engineers Richard P. Ray, Ph.D., P.E. Error Analysis.
Round-Off and Truncation Errors
Number Systems Standard positional representation of numbers:
1 Error Analysis Part 1 The Basics. 2 Key Concepts Analytical vs. numerical Methods Representation of floating-point numbers Concept of significant digits.
Computer Science 210 Computer Organization Floating Point Representation.
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
February 26, 2003MIPS floating-point arithmetic1 Question  Which of the following are represented by the hexadecimal number 0x ? —the integer.
Simple Data Type Representation and conversion of numbers
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?)
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
Information Representation (Level ISA3) Floating point numbers.
Computer Arithmetic Nizamettin AYDIN
Number Systems II Prepared by Dr P Marais (Modified by D Burford)
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
1 Lecture 5 Floating Point Numbers ITEC 1000 “Introduction to Information Technology”
CEN 316 Computer Organization and Design Computer Arithmetic Floating Point Dr. Mansour AL Zuair.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Information Representation: Negative and Floating Point.
Fixed-Point Arithmetics: Part II
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 22, 2004 Lecture Number: 24.
Computing Systems Basic arithmetic for computers.
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer.
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,
Computer Science Engineering B.E.(4 th sem) c omputer system organization Topic-Floating and decimal arithmetic S ubmitted to– Prof. Shweta Agrawal Submitted.
Round-off Errors and Computer Arithmetic. The arithmetic performed by a calculator or computer is different from the arithmetic in algebra and calculus.
CSC 221 Computer Organization and Assembly Language
Floating Point Arithmetic
Floating Point Numbers. It's all just 1s and 0s Computers are fundamentally driven by logic and thus bits of data Manipulation of bits can be done incredibly.
MECN 3500 Inter - Bayamon Lecture 3 Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 3.
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.
CS1Q Computer Systems Lecture 2 Simon Gay. Lecture 2CS1Q Computer Systems - Simon Gay2 Binary Numbers We’ll look at some details of the representation.
Data Representation. How is data stored on a computer? Registers, main memory, etc. consists of grids of transistors Transistors are in one of two states,
Numbers in Computers.
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.
Cosc 2150: Computer Organization Chapter 9, Part 3 Floating point numbers.
Introduction to Numerical Analysis I
Floating Point Representations
Binary Numbers The arithmetic used by computers differs in some ways from that used by people. Computers perform operations on numbers with finite and.
Dr. Clincy Professor of CS
Number Systems and Binary Arithmetic
Integer Division.
Floating Point Numbers: x 10-18
Floating Point Number system corresponding to the decimal notation
Number Representations
CS201 - Lecture 5 Floating Point
Dr. Clincy Professor of CS
Approximations and Round-Off Errors Chapter 3
CS 101 – Sept. 4 Number representation Integer Unsigned √ Signed √
Storing Negative Integers
Prof. Giancarlo Succi, Ph.D., P.Eng.
Chapter3 Fixed Point Representation
Number Representations
Presentation transcript:

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?)

Analog Computer for Fitting a Line to a Set of Points

Why Study Errors First? Nearly all our modeling is done on digital computers (aside: what would a non-digital analog computer look like?) A better set of terms is discrete vs. continuous (recall the discrete/continuous distinction from 1.2). Discrete devices have finite precision - we cannot represent all the different values we’d like. Finite precision leads to errors

Finite Precision with Bits Bit = value of 0 or 1 (aside: why base 2 ?) With n bits, we can distinguish 2 n different values E.g., with three bits we get eight possible values. These values can correspond to anything we want to represent… 0000AGreg 0011BWade 0102CSam 0113DJordan 1004EMark 1015FJason  1106GGaurav  1117HAlex

Floating-Point Numbers History: origins of computers in finance (banking) and military (physics). Financial calculations are (usually) fixed- point: the decimal place is fixed in one position, two digits from right: $129.95, $0.59, etc. In physical calculations, we need the decimal place to “float”: , 0.333, × 10 23, etc.

Exponential Notation Format: Mantissa X 10 Exponent, or a X 10 n Abbreviated a e n or a E n; for example, e23 Mantissa (a.k.a. significand, a.k.a. fractional part) is a floating-point number; exponent is an integer. So someone has to decide the precision: –IEEE 754 standard: with 64-bit numbers, use 52 bits for mantissa, 11 for exponent, 1 for sign (+ or −) Rough conversion: 3 bits  1 decimal digit (why?) E.g., 53 bits  16 decimal digits of precision

Normalized Notation Normalization is a common operation: e.g., percentage normalizes everything to 100: 2/4 = 75/50 = 50% Scientists usually prefer to normalize to 1: 2/4 = 75/150 = 0.5 So a normalized number in exponential notation has the decimal place immediately before the first nonzero digit: e1, e24, etc. Significant digits of a normalized floating-point number are all of the digits except leading zeros.

Precision and Magnitude Precision is the number of significant digits. Magnitude is the power of e 1 6 digits of precision Magnitude = 1

Quick Review Question 1 For the number , give a.the significand in normalized exponent notation b.the magnitude in normalized exponent notation c.the precision

Absolute and Relative Error If correct is the answer and result is the result obtained, then absolute error = | correct - result | relative error = (absolute error) | correct | = (absolute error) | correct | X 100%

Truncation To truncate a normalized number to k significant digits, eliminate all digits of the significand beyond the kth digit. E.g., truncated to 5 significant digits =.?????

Truncation To truncate a normalized number to k significant digits, eliminate all digits of the significand beyond the kth digit. E.g., truncated to 5 significant digits = Relative error = | correct - result | | correct | X 100%

Truncation To truncate a normalized number to k significant digits, eliminate all digits of the significand beyond the kth digit. E.g., truncated to 5 significant digits = Relative error = | | | | X 100%

Truncation To truncate a normalized number to k significant digits, eliminate all digits of the significand beyond the kth digit. E.g., truncated to 5 significant digits = Relative error = X 100%

Truncation To truncate a normalized number to k significant digits, eliminate all digits of the significand beyond the kth digit. E.g., truncated to 5 significant digits = Relative error = %

Rounding To round a normalized number to precision k, consider the (k+1)th significant digit d. If it is less than 5, round down the normalized number by truncating the significand to k significant digits. If d is greater than or equal to 5, round up the normalized number by truncating the significand to k significant digits and then adding 1 to the kth significant digit of the significand, carrying as necessary to digits on the left.

Quick Review Question 3 Round each of the following so that the significand has a precision of 2: a e-5 b e-5 c e-5

Round-off Error Round-off error is the problem of not having enough bits (or digits) to store an entire floating- point number and approximating the result to the nearest number that can be represented. E.g., 1/3 = ≠ 0.3 ≠ 0.33 ≠ ≠ etc.

Avoiding Round-off Error Some values (1/3) will always result in roundoff; however, we can help reduce error: –When adding numbers whose magnitudes are drastically different, accumulate smaller number before combining them with larger ones. –When multiplying and dividing, perform all multiplications in the numerator before dividing by the denominator.

Avoiding Round-off Error E.g. consider computing (x/y)z on a machine with three significant digits of precision, where x = 2.41y = 9.75z = 1.54 (x / y)z = (2.41 / 9.75)(1.54) = (0.247)(1.54) = But (x / y)z = (xz) / y: (xz) / y = ((2.41) )(1.54)) / 9.75 = 3.71 / 9.75 = 0.381

Overflow and Underflow Overflow is an error condition that occurs when there are not enough bits to express a value in a computer. Underflow is an error condition that occurs when the result of a computation is too small for the computer to represent.

Overflow and Underflow in Excel

Looping and Error Propagation A loop is a segment of code [computer instructions] that is executed repeatedly. Accumulating values in a loop (repeatedly) can produce error E.g., Patriot Missile failure in 1991 Gulf War

Patriot Missile Failure Patriot’s internal clock measured time in 1/10 of a second. Each tick of the clock added 1/10 s to current time. But 1/10 cannot be represented in a finite number of bits (just as 1/3 cannot be represented in a finite number of decimal digits)

Representing Fractions in Binary Consider ordinary Base-10 notation: what does e.g mean? Binary works the same way; e.g., what is ? = /4 = 5.025

1676 meters 0.34 sec 1 sec Patriot Missile Failure Each one-tenth increment produced an error of about seconds. After ten hours of running Patriot’s computer: = 0.34 sec 10 hr 60 min 60 sec sec 1 hr 1 min 1 sec Scud travels 1,676 meters / sec. So error = = 570 meters Result Patriot missed Scud, 28 Americans died

+ Looping and Error Propagation in Excel* Highlight; click corner; drag downward: Enter values: See apparent uniform sequence: Double click for actual values: *Courtesy of Bob Panoff

Avoiding Error Propagation in Excel* Enter first value; highlight rest: *Courtesy of Bob Panoff Do Fill/Series:

Other Ways Up?

LA Times, 1 October 1999