Can You Trust Your Computer? CS365 – Mathematics of Computer Science Spring 2007 David Uhrig Tiffany Sharrard.

Slides:



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

Scientific Notation.
Freshman Number Sets Week 3. Review Irrational Numbers Numbers that cannot be written as a fraction Rational Numbers Numbers that can be written as a.
Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved Floating-point Numbers.
Binghamton University CS-220 Spring 2015 Binghamton University CS-220 Spring 2015 Floating Point Arithmetic.
CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (2)
Floating Point Numbers
Chapter 5 Floating Point Numbers. Real Numbers l Floating point representation is used whenever the number to be represented is outside the range of integer.
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 3 Approximations and Errors.
1 Error Analysis Part 1 The Basics. 2 Key Concepts Analytical vs. numerical Methods Representation of floating-point numbers Concept of significant digits.
Objective The student will be able to: express numbers in scientific and decimal notation. Mrs. M. Williams -8 th Mathematics.
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM.
The Real Number System. The natural numbers are the counting numbers, without _______. Whole numbers include the natural numbers and ____________. Integers.
Data Types. Every program must deal with data The data is usually described as a certain type This type determines what you can do with the data and how.
Mrs.Volynskaya Real Numbers
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 31.
Scientific Notation and Standard Form
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
1.2 Properties of Real Numbers. Sets Of Numbers – Naturals Numbers: counting numbers {1, 2, 3, 4…} – Wholes Numbers: counting numbers and zero {0, 1,
Factional Values What is 0.75 in binary?. How could we represent fractions? In decimal: – As fractions : 1/5.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Information Representation: Negative and Floating Point.
Lecture 2 Number Representation and accuracy
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM CISE301_Topic1.
Slide 7- 1 Copyright © 2012 Pearson Education, Inc.
Introduction to Numerical Analysis I
Computer Science Engineering B.E.(4 th sem) c omputer system organization Topic-Floating and decimal arithmetic S ubmitted to– Prof. Shweta Agrawal Submitted.
1. Scientific Notation Every positive number X can be written as:
Using Properties of Exponents
LET’S PLAY JEOPARDY!! Team A Team B Final JeopardyJeopardy.
Round-off Errors and Computer Arithmetic. The arithmetic performed by a calculator or computer is different from the arithmetic in algebra and calculus.
Unit 2 Mid Unit Test Review
Scientific notation is a quick way of writing very large or very small numbers. Scientific Notation & Significant Digits Example #1 Write m/s.
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.
The Real Number System. Whole numbers Whole numbers Rational numbers Whole numbers Natural numbers Integers / ¾ 18% π √2√2 − ….
Significant Figure Rules RulesExamples The following are always significant Non zero digits Zeros between non zero digits Zero to the right of a non zero.
Numerical Analysis CC413 Propagation of Errors.
® Ramziah AL Kaissi REAL NUMBERS (as opposed to fake numbers?)
11/10/2015.  Copy these definitions into your notes: 1. Rational number: Any number that can be put into the form of a fraction. 2. Irrational number:
Computers and Numbers. Types of Numbers Computers store two different types of numbers: Whole Numbers AKA Integers (mathematics) AKA Fixed Point Numbers.
Complete the Following Table. From the Previous Table… What patterns do you notice in the table? How can you tell how many zeros are in a number based.
Miss Spiteri Chemistry
Number systems. Real numbers Rational numbers fractionsIntegers Negative integers Whole numbers Zero Positif integers/nat ural numbers Irrational numbers.
Copyright © 2014, 2010, and 2006 Pearson Education, Inc. Chapter 4 Polynomials.
Objective The student will be able to: express numbers in scientific and decimal notation. Designed by Skip Tyler, Varina High School.
6.1 Laws of Exponents.
Objective The student will be able to: express numbers in scientific and decimal notation. Designed by Skip Tyler, Varina High School.
Errors in Numerical Methods
COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.7 Instructor: Lin Chen Sept 2013.
5-3(D) Real Numbers.
Lecture 6: Floating Point Number Representation Information Representation: Floating Point Number Representation Lecture # 7.
Simplify the following Write all the answers using positive exponents. 1) 4 0 = 1 4) = – 72) – 7w 0 3) 5)
Numerical Analysis CC413 Propagation of Errors. 2 In numerical methods, the calculations are not made with exact numbers. How do these inaccuracies propagate.
PROPERTIES OF EXPONENTS CHAPTER 6 LESSON 1. VOCABULARY Simplify- To rewrite an expression without parentheses or negative exponents Standard Notation-
Module 2.2 Errors 03/08/2011. Sources of errors Data errors Modeling Implementation errors Absolute and relative errors Round off errors Overflow and.
Chapter 2 Errors in Numerical Methods and Their Impacts.
CSCI206 - Computer Organization & Programming
Introduction to Numerical Analysis I
Nat 4/5 Computing Science Lesson 1: Binary
Department of Computer Science Georgia State University
Fundamentals of Computer Science
Introduction To Computer Science
Scientific Notation.
Higher Level Mathematics
CSCI206 - Computer Organization & Programming
How wide is our universe?
Representation of real numbers
COMS 161 Introduction to Computing
Natural Numbers The first counting numbers Does NOT include zero
Rational Numbers and Irrational Numbers
Presentation transcript:

Can You Trust Your Computer? CS365 – Mathematics of Computer Science Spring 2007 David Uhrig Tiffany Sharrard

Introduction User's Perception of Computers Real vs. Floating Point Numbers Rounding and Chopping Over and Under Flow Machine Constants Error Propagation and Analysis New Ideas and Solutions Conclusion Questions

User ’ s Perception of Computers How are computers perceived by users? A computer is seen as an tool that will give you an exact answer What a computer may do: Can create only garbage because of how the computer handles real numbers

Example – – The answer to this is 1529, but most digital computers would return zero Why?

Real vs. Floating Point Real Number System Can be written in decimal notation Can be infinite Includes all positive and negative integers, fractions, and irrational numbers

Real vs. Floating Point Floating Point Number System A t-digit base b floating-point number form: ± d 1 d 2 d 3 … d t b e Where d 1 d 2 d 3 … d t is the mantissa, b is the base number system, e is the exponent

Real vs. Floating Point Floating Point Number System (cont ’ d) The exponent is an integer between two fixed integer bounds e1 and e2 e1 <= 0 <= e2

Real vs. Floating Point Floating Point Number System (cont ’ d) Normalized Depends on: Base b Length of the mantissa t Bounds for the exponent, e1 and e2

Rounding vs. Chopping Chop A number is chopped to t digits and all the digits past t are discarded Example: t = 5 x = result =

Rounding vs. Chopping Round A number x is rounded to t digits when x is replaced by a t digit number that approximates x with minimum error Example: t = 5 x = result =

Overflow vs. Underflow Overflow Occurs when the result of a floating point operation is larger than the largest floating point number in the given floating point number system When this occurs, almost all computers will signal an error message

Overflow vs. Underflow Underflow Occurs when the result of a computation is smaller than the smallest quantity the computer can store Some computers don ’ t see this error because the machine sets the number to zero

Machine Constants Amount of round-off depends on the floating-point format your computer uses Before the error can be corrected, the machine constants need to be identified. Constants vary greatly by hardware IEEE 754 is the Standard for Binary Floating-Point Arithmetic

Machine Constants IEEE 754 Standard

Machine Epsilon To quantify the amount of round-off error, a round-off unit is specified: ε - Machine Epsilon, or Machine Precision This is the fractional accuracy of a floating point number. Represented by: ƒl (1 + ε) ≥ 1 Where ε is the smallest floating point number the machine can generate.

Computing ɛ Program Output current Epsilon, 1 + current Epsilon E E E E E E E E E Calculated Machine epsilon: E-07 C Code * #include int main(int argc, char **argv) { float machEps=1.0f; printf("current Epsilon, 1 + current Epsilon\n"); while(1)‏ { printf("%G\t%.20f\n", machEps, (1.0f+machEps)); machEps/=2.0f; //If next epsilon yields 1, then break, because //current epsilon is the machine epsilon. if((float)(1.0+(machEps/2.0)) == 1.0)‏ break; } printf("\nCalculated Machine epsilon: %G\n", machEps); return 0; } * - Code borrowed from Wikipedia Entry on Machine Epsilon:

Error Propagation An optimistic value for the round-off accumulation in performing N arithmetic operations is roughly √ (N ɛ ). Could be N ɛ or even larger! Example: Subtractive Cancellation 4-digit base 10 arithmatic: ƒl [( ) – 10000] = 0 ( ) – = 1

Error Analysis Two primary techniques of error analysis Forward Error Analysis Floating-point representation of the error is subjected to the same mathematical operations as the data itself. Equation for the error itself Backward Error Analysis Attempt to regenerate the original mathematical problem from previously computed solutions Minimizes error generation and propagation

Testing for Error Propagation Use the computed solution in the original problem Use Double or Extended Precision rather than Single Precision Rerun the problem with slightly modified (incorrect) data and look at the results

New Ideas Increased RAM and Processor speeds allow for more intricate solutions and alternatives to floating point errors. Nonfloating-point arithmetic implementations Rational Arithmetic Multiple or Full Precision Arithmetic Scalar and Dot Products of Vectors

Conclusion User's Perception of Computers Real vs. Floating Point Numbers Rounding and Chopping Over and Under Flow Machine Constants Error Propagation and Analysis New Ideas and Solutions...Questions?