behavior of machine epsilon in simple arithmetic
<p>*using python x2</p>

<p>my homework asks me to set: eps = 2.**-52
the output of eps then becomes: 2.2204e-16</p>

<p>(1. + eps - 1. = 2.2204e-16)    # expected</p>

<p>(1. + eps/2. - 1. = 0.0)        # what?</p>

<p>My homework simply asks me what happened in the second equation. I've experimented with different sigfigs for the floats and reviewed resources but still don't understand.  Any help much appreciated!</p>

<p><code>(1 + eps/2.0) - 1 = 0.0</code> because <code>eps/2.0</code> is too small to be properly represented alongside 1 (it as called <em>absorption</em> or <em>cancellation</em>)</p>

<p>On a typical machine running Python, there are 53 bits of precision available for a Python float. If you try to go further, Python will eliminate the smallest part so the number can be properly represented.</p>

<p>In that case, 1 "wins" (1 "absorbs" <code>eps/2</code>), then substract to 1 and you get 0.</p>

python python-2.7 floating-point