Machine epsilon

The machine precision is a measure of the rounding error that occurs when the invoice with floating point numbers.

  • 5.1 Approximation in Fortran
  • 5.2 Approximation in Java
  • 5.3 Approximation in Pascal

Description

Due to the finite mantissa in the floating point representation to numbers on a computer can not represent arbitrary precision. It must be rounded. Instead, the computer uses the number for the further calculation.

If the rounding to the nearest normalized floating-point number occurs (ampersand rounds or mathematical rounds), applies to the occurring relative rounding error:

This is referred to as machine precision. is the basis of the floating point representation and the number of significant digits. The machine precision is thus the maximum relative rounding error.

If the rounding is done to one of the two adjacent normalized floating-point numbers ( rounding down, rounding up, rounding by truncation ), applies to the occurring relative rounding error:

Comments

The specified estimate of the rounding error applies only to normalized floating-point numbers. As one approaches the number zero, the relative rounding error can also be greater, increasing to 100% ( for ).

There are also other names for the machine precision in use. These are in particular rounding unit (unit roundoff ) and sometimes Maschinenepsilon (or macheps ), the term is also used for Maschinenepsilon the maximum relative distance of two adjacent normalized floating point numbers. This is the size. Hence the estimate of the relative rounding error results in rounding to an adjacent normalized floating point number: if for example in the worst case, is just greater than a normalized floating-point number and rounding off the next larger normalized floating-point number, the relative distance is less than the maximum relative distance two adjacent normalized floating-point numbers.

Example

As an example, a number system to the base 2 is to be taken with the 3 significant digits. The picture shows the corresponding floating-point numbers in the range 1 to 8

The number 4.2 will be rounded in this system 4. The absolute rounding error is then:

The relative rounding error is given by:

This is of course smaller than the machine precision for this example. The machine precision is therefore generally called a worst- case estimate.

Importance

The result of a calculation is substantially dependent on the machine precision. First, the input data can not be represented with arbitrary precision. This results in an error in the result. This error is described by the condition of the problem. Multiplying the condition with the machine accuracy obtained an estimate of this error. The second source of error arises from the inaccuracy of the algorithm used. This error amplitude is called stability. Also, this sometimes can specify the corresponding stability constant. An ill- conditioned problem, or a moderately stable algorithm therefore require a high level of machine precision or a suitable Problemumformulierung, or the use of a more stable algorithm.

Machine accuracy in practice

Today's computers are usually based on IEEE 754 The machine precision for the data types used in this case is for single precision ( single precision ) and double precision ( double precision).

Approximate calculation

In practice, the machining accuracy is determined as the smallest positive floating-point number, of the machine in question in the condition

Is satisfied. Since the intermediate results of the following program due to the use of powers of 2, or 1.0 power of 2, are either exactly or just no longer be displayed calculate the following programs the relative distance between two floating point numbers. The machine precision with symmetrical rounding is then obtained from the half of the result.

Approximation in Fortran

From Fortran 90 machine accuracy can be calculated by calling the intrinsic function epsilon ( ). For Fortran 77 following statements can be used directly (variable of type real):

UMACHN = 1.0 10 UMACHN = 0.5 * UMACHN     IF ( 1.0 0.5 * UMACHN. GT. 1.0) GOTO 10 Approximation in Java

Private static float calculateMachineEpsilonFloat () {          machEps float = 1.0f;            do             machEps / = 2.0f;          while (( float) ( 1.0 ( machEps / 2.0 )) = 1.0! );            return machEps;      } Approximation in Pascal

Machine_epsilon function: double; var one_plus_halfepsilon: double; begin    Result: = 1.0;    repeat      Result: = Result * 0.5;      { So that the result of addition guarantees of the right type,        it is assigned to a variable }      one_plus_halfepsilon: = 1.0 0.5 * Result;    until one_plus_halfepsilon < = 1.0; end; literature

  • A. Kielbasinski and H. Schwetlick: Numerical linear algebra German Academic Publishers 1988
  • Alfio Quarteroni, Riccardo Sacco, Fausto Saleri: Numerical Mathematics 1, Springer- Verlag 2002, ISBN 3-540-67878-6
554727
de