Module 2.2 Errors 03/08/2011
Sources of errors Data errors Modeling Implementation errors Absolute and relative errors Round off errors Overflow and underflow Arithmatic errors Error propagation Truncation errors
Precision:the number of significant digits Floating point number : a decimal expansion Flops: FLoating point Operations Per Second, a measure of a computer's performance, especially in fields of scientific calculations that make heavy use of floating point calculationscomputerperformancefloating point calculations Exponential notation: a floating point number as a decimal fraction times a power of 10 (a*10^n, 10 3 ) a – significand, fractional part, mantissa, n- exponent A normalized number in exp notation has the decimal point immediately preceding the first nonzero digit. The significant digits of a floating point number are all the digits except the leading zeros The significant digits of an integer are all the digits except the leading and trailing zeros
Exponential notation Example: 10 3 Fractional part or significand? Exponent? 3 Normalized? 10 5
Significant digits Significant digits of floating point number All digits except leading zeros Number of significant digits in 10 3 ? 9 significant digits Precision Number of significant digits
Magnitude Power of 10 when number expressed in normalized exponential notation Magnitude of 10 3 ? Magnitude of 10 5 ? 10 5
Absolute error |correct – result| Example: correct = 10 5 and result = 10 5 Absolute error = ? | 10 5 | = 10 5 = 0.990
Relative error |(correct - result) / correct| Example: (correct - result) = and correct = /( 10 5 ) = 10 -5
Round-off error Problem of not having enough bits to store entire floating point number(round up, round down) and approximating the result to the nearest number that can be represented Example: 10 5 if only can store 6 significant digits, rounded? 10 5 Do not test directly for equality of floating point variables
Overflow/underflow Overflow - error condition that occurs when not enough bits to express value in computer Underflow - error condition that occurs when result of computation is too small for computer to represent
Arithematic errors;Algebra rules do not necessarily hold x = 355/113, y = 101/112, z = 52/113 All different ways of calculating x - 3y - z should be 0, but is not
Addition and subtraction errors If big difference in magnitude of numbers Example: (0.65 10 5 ) + (0.98 ) = ? = Suppose can store 6 significant digits rounded? = ( 10 5 )
Associative property Does not necessarily hold Sum of many small numbers + large number may not equal adding each small number to large number Similarly, distributive property does not necessarily hold
Cancellation error Problem of subtracting numbers that are almost equal Answer can have fewer significant digits than original numbers
To reduce numerical errors Round-off errors Use maximum number of significant digits If big difference in magnitude of numbers Add from smallest to largest numbers
Propagated (accumulation ) round-off errors Example: repeatedly executing t = t + dt Better to repeatedly increment i and calculate t = i * dt
Truncation error Error that occurs when truncated, or finite, sum is used as approximation for sum of infinite series