Floating Point Error Estimate
Contents |
by David Goldberg, published in the March, 1991 issue of Computing Surveys. Copyright 1991, Association for Computing Machinery, Inc., reprinted floating point error example by permission. Abstract Floating-point arithmetic is considered an esoteric subject floating point rounding error by many people. This is rather surprising because floating-point is ubiquitous in computer systems. Almost every
Floating Point Arithmetic Examples
language has a floating-point datatype; computers from PCs to supercomputers have floating-point accelerators; most compilers will be called upon to compile floating-point algorithms from time to
Floating Point Arithmetic Error
time; and virtually every operating system must respond to floating-point exceptions such as overflow. This paper presents a tutorial on those aspects of floating-point that have a direct impact on designers of computer systems. It begins with background on floating-point representation and rounding error, continues with a discussion of the IEEE floating-point standard, floating point calculator and concludes with numerous examples of how computer builders can better support floating-point. Categories and Subject Descriptors: (Primary) C.0 [Computer Systems Organization]: General -- instruction set design; D.3.4 [Programming Languages]: Processors -- compilers, optimization; G.1.0 [Numerical Analysis]: General -- computer arithmetic, error analysis, numerical algorithms (Secondary) D.2.1 [Software Engineering]: Requirements/Specifications -- languages; D.3.4 Programming Languages]: Formal Definitions and Theory -- semantics; D.4.1 Operating Systems]: Process Management -- synchronization. General Terms: Algorithms, Design, Languages Additional Key Words and Phrases: Denormalized number, exception, floating-point, floating-point standard, gradual underflow, guard digit, NaN, overflow, relative error, rounding error, rounding mode, ulp, underflow. Introduction Builders of computer systems often need information about floating-point arithmetic. There are, however, remarkably few sources of detailed information about it. One of the few books on the subject, Floating-Point Computation by Pat Sterbenz, is long out of print. This paper is a tutorial on those aspects of floating-point arithmetic (floating-point hereafter) that have a direct co
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us
What Every Computer Scientist Should Know About Floating-point Arithmetic
Learn more about Stack Overflow the company Business Learn more about hiring developers floating point addition or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack floating point representation Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Estimate error in floating point calculations up https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html vote 0 down vote favorite 2 One important property of IEEE floating-point math that rounding causes "errors" in calculations due to the limited number of bits and the base-2 format. E.g. in C#: (Math.PI * 1e20 / 1e20) == Math.PI; // false Is there a way to determine the magnitude of the error of those operations? .NET exposes the Double.Epsilon field that give the smallest significant value http://stackoverflow.com/questions/10196932/estimate-error-in-floating-point-calculations greater than zero, but that's not relevant for comparing non-zero numbers. EDIT: I'm not asking for a way to exactly compute the error, I'm just trying to find a way to estimate its magnitude. For example (again, in C#): (1e20 + 1e3) == 1e20; // true (1e20 + 1e4) == 1e20; // false So the error of the operation 1e20 + X appears to be approximately 1e3, which makes sense because doubles have up to 17 digits of decimal precision. .net floating-point double share|improve this question edited Apr 17 '12 at 20:25 asked Apr 17 '12 at 18:31 Henry Jackson 3,03852848 1 I suppose you should just calculate the error estimation based on your calculations. You may find some helpful information here: stackoverflow.com/questions/3166851/…. –Lukasz M Apr 17 '12 at 19:39 The error is discrete and cumulative and it may or may not occur for each calculation. To predict or calculate the exact error for every calculation would be extremely time consuming (you would have to do a software calculation to another arbitrary precision to do this) but it can be done. You could also do this with something like delphi which supports 80-bit extended precision
be challenged and removed. (July 2012) (Learn how and when to remove this template message) Example of LOS in case of computing 2 forms of the same function Loss https://en.wikipedia.org/wiki/Loss_of_significance of significance is an undesirable effect in calculations using finite-precision arithmetic. It occurs when an operation on two numbers increases relative error substantially more than it increases absolute error, for example in subtracting two nearly equal numbers (known as catastrophic cancellation). The effect is that the number of significant digits in the result is reduced unacceptably. Ways to avoid this effect are floating point studied in numerical analysis. Contents 1 Demonstration of the problem 2 Workarounds 3 Loss of significant bits 4 Instability of the quadratic equation 4.1 A better algorithm 5 See also 6 References Demonstration of the problem[edit] The effect can be demonstrated with decimal numbers. The following example demonstrates loss of significance for a decimal floating-point data type with 10 significant digits: floating point error Consider the decimal number 0.1234567891234567890 A floating-point representation of this number on a machine that keeps 10 floating-point digits would be 0.1234567891 which is fairly close when measuring the error as a percentage of the value. It is very different when measured in order of precision. The first is accurate to 6981099999999999999♠10×10−20, while the second is only accurate to 6991100000000000000♠10×10−10. Now perform the calculation 0.1234567891234567890 − 0.1234567890000000000 The answer, accurate to 10 significant digits, is 0.0000000001234567890 However, on the 10-digit floating-point machine, the calculation yields 0.1234567891 − 0.1234567890 = 0.0000000001 In both cases the result is accurate to same order of magnitude as the inputs (-20 and -10, respectively). In the second case, the answer seems to have one significant digit, which would amount to loss of significance. However, in computer floating point arithmetic, all operations can be viewed as being performed on antilogarithms, for which the rules for significant figures indicate that the number of sigfigs remains the same as the smallest number of sigfigs in the mantissas. The way to indicate this and represent the answer to 10 sigfigs is: 6990100000000000000♠1.00
be down. Please try the request again. Your cache administrator is webmaster. Generated Fri, 14 Oct 2016 10:26:16 GMT by s_ac4 (squid/3.5.20)