1 COMS 161 Introduction to Computing Title: Numeric Processing Date: November 10, 2004 Lecture Number: 31.

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

CML CML CS 230: Computer Organization and Assembly Language Aviral Shrivastava Department of Computer Science and Engineering School of Computing and Informatics.
CSCI 5230: Project Management Software Reuse Disasters: Therac-25 and Ariane 5 Flight 501 David Sumpter 12/4/2001.
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.
What is Rounding Error? AiS Challenge STI 2003 Richard Allen.
Chapter 8 Representing Information Digitally.
23/05/2015Dr Andy Brooks1 FOR0383 Software Quality Assurance Lecture 2 ESA Ariane 5 Rocket Flight 501.
Types and Variables. Computer Programming 2 C++ in one page!
©Ian Sommerville 2000CS 365 Ariane 5 launcher failureSlide 1 The Ariane 5 Launcher Failure June 4th 1996 Total failure of the Ariane 5 launcher on its.
Sizes of simple data types sizeof(char) = 1 size(short) = 2 sizeof(int) = 4 size(long) = 8 sizeof(char) = 1 size(short) = 2 sizeof(int) = 2 size(long)
Assembly Language and Computer Architecture Using C++ and Java
ARIANE 5 FAILURE ► BACKGROUND:- ► European space agency’s re-useable launch vehicle. ► Ariane-4 was a major success ► Ariane -5 was developed for the larger.
1 CSC 1401 Computer Programming I Hamid Harroud School of Science and Engineering, Akhawayn University
Assembly Language and Computer Architecture Using C++ and Java
CS1061 C Programming Lecture 7: Floating Point A. O’Riordan, 2004.
Computer Science 210 Computer Organization Floating Point Representation.
©Ian Sommerville 2004Software Engineering Case Studies Slide 1 The Ariane 5 Launcher Failure June 4th 1996 Total failure of the Ariane 5 launcher on its.
February 26, 2003MIPS floating-point arithmetic1 Question  Which of the following are represented by the hexadecimal number 0x ? —the integer.
CPS120: Introduction to Computer Science Lecture 8.
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?)
The Ariane 5 Launcher Failure
CRASH AND BURN ARIANE 5 Kristen Hieronymus SYSM6309 Advanced Requirements Engineering
Information Representation (Level ISA3) Floating point numbers.
1 Lecture 5 Floating Point Numbers ITEC 1000 “Introduction to Information Technology”
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 22, 2004 Lecture Number: 24.
The Ariane 5 Launcher Failure June 4th 1996 Total failure of the Ariane 5 launcher on its maiden flight.
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.
Numeric Processing Chapter 6, Exploring the Digital Domain.
Chapter 7 Simple Date Types J. H. Wang ( 王正豪 ), Ph. D. Assistant Professor Dept. Computer Science and Information Engineering National Taipei University.
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?)
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 20, 2004 Lecture Number: 23.
Representing numbers and Basic MATLAB 1. Representing numbers  numbers used by computers do not behave the same as numbers used in mathematics  e.g.,
Summary of what we learned yesterday Basics of C++ Format of a program Syntax of literals, keywords, symbols, variables Simple data types and arithmetic.
Round-off Errors and Computer Arithmetic. The arithmetic performed by a calculator or computer is different from the arithmetic in algebra and calculus.
Lecture 08 – Documentation, debugging.  docstring  A special kind of string (text) used to provide documentation  Appears at the top of a module 
Term 2, 2011 Week 1. CONTENTS Problem-solving methodology Programming and scripting languages – Programming languages Programming languages – Scripting.
Chapter 3 – Variables and Arithmetic Operations. Variable Rules u Must declare all variable names –List name and type u Keep length to 31 characters –Older.
“I am not in the office at the moment. Send any work to be translated.”
 Lecture 2 Processor Organization  Control needs to have the  Ability to fetch instructions from memory  Logic and means to control instruction sequencing.
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.
1 COMS 161 Introduction to Computing Title: Computing Basics Date: September 8, 2004 Lecture Number: 7.
A First Book of C++ Chapter 4 Selection. Objectives In this chapter, you will learn about: –Relational Expressions –The if-else Statement –Nested if Statements.
Types Chapter 2. C++ An Introduction to Computing, 3rd ed. 2 Objectives Observe types provided by C++ Literals of these types Explain syntax rules for.
Topic 10Summer Ariane 5 Some slides based on talk from Sommerville.
Module 2.2 Errors 03/08/2011. Sources of errors Data errors Modeling Implementation errors Absolute and relative errors Round off errors Overflow and.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
A First Book of C++ Chapter 4 Selection.
Cosc 2150: Computer Organization Chapter 9, Part 3 Floating point numbers.
CS 105 “Tour of the Black Holes of Computing!”
EPSII 59:006 Spring 2004.
Fault Tolerant Computing
Ariane 5 Software error Integer overflow.
Chapter 6 Floating Point
Floating Point.
COMS 361 Computer Organization
CS 101 – Sept. 4 Number representation Integer Unsigned √ Signed √
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
Computer Organization
Floating Point Numbers
Computer Organization COMP 210
CS 105 “Tour of the Black Holes of Computing!”
COMS 161 Introduction to Computing
COMS 161 Introduction to Computing
Computer Organization and Assembly Language
CS 105 “Tour of the Black Holes of Computing!”
Presentation transcript:

1 COMS 161 Introduction to Computing Title: Numeric Processing Date: November 10, 2004 Lecture Number: 31

2 Announcements

3 Review Real numbers –Representation Single precision Double precision

4 Outline Real numbers –Limitations

5 Real (Decimal) Number Storage Numbers have limited precision Compute 1

6 Real (Decimal) Number Storage #include void main() { cout << "precision example" << endl; cout << "Number of bytes in a float: " << sizeof(float) << endl; float epsilon = 1.0f, value; int iteration = 0; int maxIteration = 100; while(iteration < maxIteration) { epsilon /= 2.0; value = 1.0f + epsilon; if (value == 1) break; iteration++; } // end while(...) cout << "Iteration: " << iteration << " Epsilon: " << epsilon <<" Value: " << value << endl << endl; iteration = 0; double epsilonD = 1.0, valueD; cout << "Number of bytes in a double: " << sizeof(double) << endl; while(iteration < maxIteration) { epsilonD /= 2.0; valueD = epsilonD; if (valueD == 1) break; iteration++; } // end while(...) cout << "Iteration: " << iteration << " Epsilon: " << epsilonD <<" Value: " << valueD << endl; }

7 Real (Decimal) Number Storage Numbers have limited precision –Most real numbers have an infinite decimal expansion 1/3 10 = … 10 –Clearly, the floating point representation will also be infinite

8 Real (Decimal) Number Storage –Real numbers with a finite number of digits may require an infinite number of bits for a binary representation 1/10 10 = = … … 2 * 2 -4 s = 0, e = = = f = … x3DCCCCCC

9 Real Number Storage Limited Range and Precision There are three categories of numbers left out when floating point representation is used –Numbers out of range because their absolute value is too large (similar to integer overflow) –Numbers out of range because their absolute value is too small (numbers too near zero to be stored given the precision available –Numbers whose binary representations require either an infinite number of binary digits or more binary digits than the bits available

10 Real Number Storage Limited Range and Precision Illustrated With one bit to the right of the decimal point, only the real number 0.5 can be represented.

11 Real Number Storage Limited Range and Precision Illustrated real numbers that can be represented with two bits 0.25, 0.5, 0.75 real numbers that can be represented with three bits 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, The holes correspond to all the unrepresented numbers: 0.126, 0.255, 0.3, …

12 Limited Range and Precision Some Consequences Limited range will invalidate certain calculations –If integers are involved, this can often be avoided by switching to real numbers –For real number calculations, this problem arises infrequently and in those cases can sometimes be handled by special methods –It is not a common occurrence in non- scientific work

13 Limited Range and Precision Some Consequences Limited precision for real numbers is very pervasive –Assume that most decimal calculations will, in fact, be in error! –Evaluate and use computer calculations with this in mind

14 Risks in Numerical Computing Almost all computer calculations involve roundoff error (limited precision error) If not monitored and planned for carefully, such errors can lead to unexpected and catastrophic results –Arianne 5 Rocket Failure –Patriot Missile Failure during Gulf War

15 Risks in Numerical Computing On 4 June 1996, the maiden flight of the Ariane 5 launcher ended in a failure. Only about 40 seconds after initiation of the flight sequence, at an altitude of about 3700 m, the launcher veered off its flight path, broke up and exploded. Engineers from the Ariane 5 project teams of CNES and Industry immediately started to investigate the failureOn 4 June 1996

16 Risks in Numerical Computing Based on the extensive documentation and data on the Ariane 501 failure made available to the Board, the following chain of events, their inter-relations and causes have been established, starting with the destruction of the launcher and tracing back in time towards the primary cause. The launcher started to disintegrate at about H seconds because of high aerodynamic loads due to an angle of attack of more than 20 degrees that led to separation of the boosters from the main stage, in turn triggering the self-destruct system of the launcher. This angle of attack was caused by full nozzle deflections of the solid boosters and the Vulcain main engine. These nozzle deflections were commanded by the On-Board Computer (OBC) software on the basis of data transmitted by the active Inertial Reference System (SRI 2). Part of these data at that time did not contain proper flight data, but showed a diagnostic bit pattern of the computer of the SRI 2, which was interpreted as flight data. The reason why the active SRI 2 did not send correct attitude data was that the unit had declared a failure due to a software exception. The OBC could not switch to the back-up SRI 1 because that unit had already ceased to function during the previous data cycle (72 milliseconds period) for the same reason as SRI 2. The internal SRI software exception was caused during execution of a data conversion from 64-bit floating point to 16-bit signed integer value. The floating point number which was converted had a value greater than what could be represented by a 16-bit signed integer. This resulted in an Operand Error. The data conversion instructions (in Ada code) were not protected from causing an Operand Error, although other conversions of comparable variables in the same place in the code were protected. The error occurred in a part of the software that only performs alignment of the strap-down inertial platform. This software module computes meaningful results only before lift-off. As soon as the launcher lifts off, this function serves no purpose. The alignment function is operative for 50 seconds after starting of the Flight Mode of the SRIs which occurs at H0 - 3 seconds for Ariane 5. Consequently, when lift-off occurs, the function continues for approx. 40 seconds of flight. This time sequence is based on a requirement of Ariane 4 and is not required for Ariane 5. The Operand Error occurred due to an unexpected high value of an internal alignment function result called BH, Horizontal Bias, related to the horizontal velocity sensed by the platform. This value is calculated as an indicator for alignment precision over time. The value of BH was much higher than expected because the early part of the trajectory of Ariane 5 differs from that of Ariane 4 and results in considerably higher horizontal velocity values.

17 Risks in Numerical Computing The Patriot battery at Dhahran failed to track and intercept the Scud missile because of a software problem in the system's weapons control computer. This problem led to an inaccurate tracking calculation that became worse the longer the system operated. At the time of the incident, the battery had been operating continuously for over 100 hours. By then, the inaccuracy was serious enough to cause the system to look in the wrong place for the incoming Scud.Patriot The Patriot had never before been used to defend against Scud missiles nor was it expected to operate continuously for long periods of time. Two weeks before the incident, Army officials received Israeli data indicating some loss in accuracy after the system had been running for 8 consecutive hours. Consequently, Army officials modified the software to improve the system's accuracy. However, the modified software did not reach Dhahran until February 26, the day after the Scud incident.

18 Software for Numerical Work Software Libraries Spreadsheets Mathematical Software –symbolic manipulation –data analysis –data visualization