Floating Point/Epsilon

From testwiki
Jump to navigation Jump to search

Template:Floating Point Page

Granularity

Floating point numbers, because they are comprised of only a certain number of bits, have a granularity. They therefore cannot express an infinite amount of fractional values. This means that there is a "Largest Possible Value", ε, that satisfies the following equation:

1.0ϵ=1.0

This value is called the machine epsilon of the floating point system.

Epsilon (ε)

When a real number is rounded to the nearest floating point number, the machine epsilon forms an upper bound on the relative error. This fact makes the machine epsilon extremely useful in determining the convergence tolerances of many iterative numerical algorithms.

Determining Epsilon

The machine epsilon[1] can be computed according to the formula:

ϵ=b2bp

So, for IEEE 754 single precision we have

ϵ=224=5.96046447753906×108

and for IEEE 754 double precision we have

ϵ=253=1.11022302462516×1016

When p is not known, but b is known to be 2, the machine epsilon can be found by starting with a trial value of, say, 0.5 and successively dividing the value by 2 until 1.0ϵ=1.0 is true.

Granularity Effects

An effect of this granularity is that some basic algebraic properties don't strictly hold. For instance, if we have three floating-point values, x, y, and z, we can show that:

x+(y+z)(x+y)+z

When the floating-point numbers are used in iterative calculations, round-off and granularity errors can result in large errors.

References

Template:BookCat