1cs542g-term1-2007 CS542G - Breadth in Scientific Computing.

Slides:



Advertisements
Similar presentations
Roundoff and truncation errors
Advertisements

1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 2: Data types and addressing modes dr.ir. A.C. Verschueren.
2009 Spring Errors & Source of Errors SpringBIL108E Errors in Computing Several causes for malfunction in computer systems. –Hardware fails –Critical.
Fabián E. Bustamante, Spring 2007 Floating point Today IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time.
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Topics covered: Floating point arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Binghamton University CS-220 Spring 2015 Binghamton University CS-220 Spring 2015 Floating Point Arithmetic.
Floating Point Numbers
Introduction to Scientific Computing ICE / ICE 508 Prof. Hyuckjae Lee KAIST- ICC
University of Washington Today: Floats! 1. University of Washington Today Topics: Floating Point Background: Fractional binary numbers IEEE floating point.
University of Washington Today Topics: Floating Point Background: Fractional binary numbers IEEE floating point standard: Definition Example and properties.
COS 323: Computing for the Physical and Social Sciences Szymon Rusinkiewicz.
COS 323: Computing for the Physical and Social Sciences Szymon Rusinkiewicz.
1cs542g-term CS542G - Breadth in Scientific Computing.
CSE 378 Floating-point1 How to represent real numbers In decimal scientific notation –sign –fraction –base (i.e., 10) to some power Most of the time, usual.
Floating-Point and High-Level Languages Programming Languages Spring 2004.
Floating Point Numbers
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
Binary Representation and Computer Arithmetic
Introduction to Computing Systems from bits & gates to C & beyond Chapter 2 Bits, Data Types & Operations Integer Representation Floating-point Representation.
IEEE Floating Point Numbers Overview Noah Mendelsohn Tufts University Web: COMP.
February 26, 2003MIPS floating-point arithmetic1 Question  Which of the following are represented by the hexadecimal number 0x ? —the integer.
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.
Computer Organization and Architecture Computer Arithmetic Chapter 9.
Computer Arithmetic Nizamettin AYDIN
Number Systems II Prepared by Dr P Marais (Modified by D Burford)
Number Systems So far we have studied the following integer number systems in computer Unsigned numbers Sign/magnitude numbers Two’s complement numbers.
MATH 685/CSI 700 Lecture Notes Lecture 1. Intro to Scientific Computing.
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
Data Representation in Computer Systems
Computer Science Engineering B.E.(4 th sem) c omputer system organization Topic-Floating and decimal arithmetic S ubmitted to– Prof. Shweta Agrawal Submitted.
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
Oct. 18, 2007SYSC 2001* - Fall SYSC2001-Ch9.ppt1 See Stallings Chapter 9 Computer Arithmetic.
Round-off Errors.
HW 3 Due 3/9 (Mon) 11:00 AM Probs. 2.81, 2.87, 2.88.
CSC 221 Computer Organization and Assembly Language
COMP201 Computer Systems Floating Point Numbers. Floating Point Numbers  Representations considered so far have a limited range dependent on the number.
Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication
1 Floating Point Operations - Part II. Multiplication Do unsigned multiplication on the mantissas including the hidden bits Do unsigned multiplication.
Computer Arithmetic Floating Point. We need a way to represent –numbers with fractions, e.g., –very small numbers, e.g., –very large.
Computer Arithmetic See Stallings Chapter 9 Sep 10, 2009
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Floating Point Numbers Representation, Operations, and Accuracy CS223 Digital Design.
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 University of Washington Fractional binary numbers What is ?
Cosc 2150: Computer Organization Chapter 9, Part 3 Floating point numbers.
Introduction to Numerical Analysis I
Floating Point Representations
Computer Architecture & Operations I
Topics IEEE Floating Point Standard Rounding Floating Point Operations
Floating Point Number system corresponding to the decimal notation
IEEE floating point format
Chapter 6 Floating Point
Chapter 2 Bits, Data Types & Operations Integer Representation
CSCI206 - Computer Organization & Programming
How to represent real numbers
Approximations and Round-Off Errors Chapter 3
Presentation transcript:

1cs542g-term CS542G - Breadth in Scientific Computing

2cs542g-term Web   Course schedule Slides online, but you need to take notes too!  Reading No text, but if you really want one, try Heath… Relevant papers as we go  Assignments + Final Exam information Look for Assignment 1  Resources

3cs542g-term Contacting Me  Robert Bridson X663 (new wing of CS building) Drop by, or make an appointment (safer) (or just 21993)  I always like feedback! Ask questions if I go too fast…

4cs542g-term Evaluation  ~4 assignments (40%)  Final exam (60%)

5cs542g-term MATLAB  Tutorial Sessions at UBC  Aimed at students who have not previously used Matlab.  Wed. Sept. 12, 5 - 7pm, DMP

6cs542g-term Floating Point

7cs542g-term Numbers  Many ways of representing real numbers  Apart from some specialized applications and/or hardware, floating point is pervasive  Speed: while not as simple as fixed point from a hardware point of view, not too bad CPU’s, GPU’s now tend to have a lot of FP resources  Safety: designed to do as good a job as reasonably possible with fixed size Arbitrary precision numbers can be much more costly (though see J. Shewchuk’s work on leveraging FPU’s to compute extended precision) Interval arithmetic tends to be overly pessimistic

8cs542g-term Floating Point Basics  Sign, Mantissa, Exponent  Epsilon  Rounding  Absolute Error vs. Relative Error

9cs542g-term IEEE Floating Point  32-bit and 64-bit versions defined (and more on the way)  Most modern hardware implements the standard Though it may not be possible to access all capabilities from a given language GPU’s etc. often simplify for speed  Designed to be as safe/accurate/controlled as possible Also allows some neat bit tricks…

10cs542g-term IEEE Special Numbers  +/- infinity When you divide 1/0 for example, or log(0) Can handle some operations consistently Instantly slows down your code  NaN (Not a Number) The result of an undefined operation e.g. 0/0 Any operation with a NaN gives a NaN  Clear traceable failure deemed better than silent “graceful” failure! Nan != NaN

11cs542g-term Exact numbers in fp  Integers (up to the range of the mantissa) are exact  Those integers times a power of two (up to the range of the exponent) are exact  Other numbers are rounded Simple fractions 1/3, 1/5, 0.1, etc. Very large integers

12cs542g-term Floating point gotchas  Floating point arithmetic is commutative: a+b=b+a and ab=ba  But not associative in general: (a+b)+c ≈ a+(b+c)  Not distributive in general: a(b+c) ≈ ab+ac  Results may change based on platform, compiler settings, presence of debugging print statements, …  See required reading on web

13cs542g-term Cancellation  The single biggest issue in fp arithmetic  Example: Exact arithmetic: = significant digits in operation: = Result only has one significant digit (if that)  When close numbers are subtracted, significant digits cancel, left with bad relative error  Absolute error is still fine…

14cs542g-term Cancellation Example 1  Can sometimes be easily cured  For example, solving quadratic ax 2 +bx+c=0 with real roots

15cs542g-term Cancellation Example 2  Sometimes not obvious to cure  Estimate the derivative of an unknown function

16cs542g-term Accumulation  2+eps=2  (2+eps)+eps=2  ((2+eps)+eps)+eps=2  …  Add any number of eps to 2, always get 2  But if we add all the eps first, then add to 2, we get a more accurate result

17cs542g-term Stability and Well-Posedness  A problem is well-posed if small perturbations/errors in the “data” lead to small perturbations in solution (and solution exists and is unique)  A numerical method for a well-posed problem might not be well-posed itself: unstable method  Floating-point operations introduce error, even if all else is exact

18cs542g-term Performance  Vectorization, ILP  Separate fp / int pipelines  Caches, prefetch  Page faults  Multi-core, multi-processors  Use good libraries when you can!