What is a simple example of floating point/rounding error?

Picture is worth a thousand words – try to draw equation f(k) :
enter image  description here
and you will get such XY graph (X and Y are in logarithmic scale).
enter image description here

If computer could represent 32-bit floats without rounding error then for every k we should get zero. But instead error increases with bigger values of k because of floating point error accumulation.

hth!

Leave a Comment