© University of Liverpool

Slides:



Advertisements
Similar presentations
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.
Advertisements

Fabián E. Bustamante, Spring 2007 Floating point Today IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time.
CS 351/ IT 351 Modeling and Simulation Technologies Errors In Models Dr. Jim Holten.
Representing fractions – Fixed point The problem: How to represent fractions with finite number of bits ?
University of Washington Today Topics: Floating Point Background: Fractional binary numbers IEEE floating point standard: Definition Example and properties.
ECIV 201 Computational Methods for Civil Engineers Richard P. Ray, Ph.D., P.E. Error Analysis.
1 CSE1301 Computer Programming Lecture 30: Real Number Representation.
CSE1301 Computer Programming Lecture 33: Real Number Representation
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.
1 Error Analysis Part 1 The Basics. 2 Key Concepts Analytical vs. numerical Methods Representation of floating-point numbers Concept of significant digits.
Floating Point Numbers
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 31.
Simple Data Type Representation and conversion of numbers
Ch. 2 Floating Point Numbers
Information Representation (Level ISA3) Floating point numbers.
Computer Organization and Architecture Computer Arithmetic Chapter 9.
Computer Arithmetic Nizamettin AYDIN
CEN 316 Computer Organization and Design Computer Arithmetic Floating Point Dr. Mansour AL Zuair.
Introduction to Numerical Analysis I
ECE232: Hardware Organization and Design
Floating Point Numbers Topics –IEEE Floating Point Standard –Rounding –Floating Point Operations –Mathematical properties.
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
Data Representation in Computer Systems
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
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.
CS 61C L3.2.1 Floating Point 1 (1) K. Meinz, Summer 2004 © UCB CS61C : Machine Structures Lecture Floating Point Kurt Meinz inst.eecs.berkeley.edu/~cs61c.
Data Representation: Floating Point for Real Numbers Computer Organization and Assembly Language: Module 11.
ESO 208A/ESO 218 LECTURE 2 JULY 31, ERRORS MODELING OUTPUTS QUANTIFICATION TRUE VALUE APPROXIMATE VALUE.
1 Floating Point. 2 Topics Fractional Binary Numbers IEEE 754 Standard Rounding Mode FP Operations Floating Point in C Suggested Reading: 2.4.
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
Floating Point CSE 238/2038/2138: Systems Programming
Floating Point Borrowed from the Carnegie Mellon (Thanks, guys!)
Floating Point Numbers
2.4. Floating Point Numbers
CSCI206 - Computer Organization & Programming
Lecture 9: Floating Point
Topics IEEE Floating Point Standard Rounding Floating Point Operations
Floating Point Numbers: x 10-18
CS 367 Floating Point Topics (Ch 2.4) IEEE Floating Point Standard
A Level Computing Component 2
Topic 3d Representation of Real Numbers
Chapter 2 ERROR ANALYSIS
Recent from Dr. Dan Lo regarding 12/11/17 Dept Exam
Number Representations
Floating Point Representation
CS 105 “Tour of the Black Holes of Computing!”
How to represent real numbers
Approximations and Round-Off Errors Chapter 3
Floating Point Arithmetic August 31, 2009
CS 105 “Tour of the Black Holes of Computing!”
COMS 361 Computer Organization
Faculty of Cybernetics, Statistics and Economic Informatics –
October 17 Chapter 4 – Floating Point Read 5.1 through 5.3 1/16/2019
Recent from Dr. Dan Lo regarding 12/11/17 Dept Exam
CS213 Floating Point Topics IEEE Floating Point Standard Rounding
COMS 161 Introduction to Computing
Topic 3d Representation of Real Numbers
CS 105 “Tour of the Black Holes of Computing!”
Number Representations
Presentation transcript:

© University of Liverpool NUMERIC TESTING COMP220/285 © University of Liverpool

© University of Liverpool Numeric functions Used for Financial calculations Real time control Breaking distance Flight control parameters Often depend on Estimated and sampled data Statistics COMP220/185 © University of Liverpool

Testing numeric functions Two basic categories Integer functions Real number functions Discrete integer functions Large but finite space In theory possible to test every case Floating point inputs Infinite domain mapped to finite address space COMP220/185 © University of Liverpool

© University of Liverpool Integer space 8-bit 0-255 or -128 to +127 32-bit 0- 4,294,967,295 or -2,147,483,648 to 2147483647 64-bit space 0 to 18,446,744,073,709,551,616 COMP220/185 © University of Liverpool

© University of Liverpool Floating point issues Imagine we have 5 bit exponent range -16 to +15 Normalization 0.00001 x 2^-10 Represented as 1 x 2^-15 If number is too small result will be de-normalized 0.0000001x 2^-10 Normalizes to 1x2^-17 (overflow exponent) So we can only go to 0.01x 2^-10 In IEEE the denormalised format is 0.m x 2^exp (where exp=-126 or -1022) Denormalized storage generally means loss of expected precision COMP220/185 © University of Liverpool

© University of Liverpool Floating point review Mantissa x 2^exponent Implications Mantissa is fixed size in decimal points So worst error is proportional to exponent size e.g. 8-bits, smallest number is (½)^8 As the exponent increases the error increases COMP220/185 © University of Liverpool

© University of Liverpool Testing and errors   COMP220/185 © University of Liverpool

Floating point distribution   COMP220/185 © University of Liverpool

© University of Liverpool Conditioning number Error output Error output error error COMP220/185 © University of Liverpool

© University of Liverpool Conditioning number   COMP220/185 © University of Liverpool

Conditioning number for differentiable functions and small error   COMP220/185 © University of Liverpool

Conditioning implications Example When solving linear equations, the system is called ill-conditioned if a small change in the input causes a large change in solution So ill-conditioned designs/algorithms can cause Instability of output Problems with the behaviour of physical systems, imagine electronic circuit, each component can have a range of values due to component tolerances COMP220/185 © University of Liverpool

Conditioning in algorithmic steps y1=1/(1-x) y2=y1 x (1-x)*(1+x) y2 should equal? COMP220/185 © University of Liverpool

Conditioning number and testing If 1 of your calculation steps has high condition number, this can lead to large errors on result Possible to have well conditioned function but with poorly conditioned step in algorithm COMP220/185 © University of Liverpool

Testing numeric functions | Fcalc(x)- Ftrue(x) | < tolerance Fcalc(x) is the value produce by our program To calculate Ftrue we can use a arbitary precision maths package such as GMP gmplib.org But what about the tolerance COMP220/185 © University of Liverpool

© University of Liverpool Tolerance Function of Unit of Least Precision This is dependent on X Function of the condition number The greater the condition factor, the greater the effect of loss of precision In general Tolerance <= Cn x ULP X f(x)/x This is from slide 11 COMP220/185 © University of Liverpool

Types of function tests   COMP220/185 © University of Liverpool

© University of Liverpool Numeric test examples Log10 Log10(1)=0 (true for all logs) Log10(10)=1 Log10(100)=10 Log10(sqrt(10)) = 0.5 Log10(0.1)=-1 Log10(0)=Error Log10(-1)=Error COMP220/185 © University of Liverpool

© University of Liverpool Special values Nan (not a number or not a “real” number E.g. log(-1)=Nan sqrt(-100) + - Is this the same as overflow? Is 1+largest_number =  1/0 Underflow Not zero but not representable? COMP220/185 © University of Liverpool

Inverse function tests   COMP220/185 © University of Liverpool <Program Title>

Limitations of identities   COMP220/185 © University of Liverpool

© University of Liverpool Intermediary results   COMP220/185 © University of Liverpool

© University of Liverpool Summary Numeric function testing relies on The properties of the function being tested (condition number, argument type) Having proper values for Correct function output Tolerance for the test COMP220/185 © University of Liverpool

© University of Liverpool Summary Functions can Special values golden values Linked together to give identities Be tested using a previously tested inverse function COMP220/185 © University of Liverpool