Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm drawing this answer from the MATLAB documentation for the function <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/eps.html" rel="noreferrer">EPS</a>, but it should apply universally to <a href="http://en.wikipedia.org/wiki/IEEE_754" rel="noreferrer">IEEE-754</a> floating point numbers.</p> <p>For a given floating point number <strong>X</strong>, if</p> <pre><code>2^E &lt;= abs(X) &lt; 2^(E+1) </code></pre> <p>then the distance from <strong>X</strong> to the next largest representable floating point number (<strong>epsilon</strong>) is:</p> <pre><code>epsilon = 2^(E-52) % For a 64-bit float (double precision) epsilon = 2^(E-23) % For a 32-bit float (single precision) epsilon = 2^(E-10) % For a 16-bit float (half precision) </code></pre> <p>The above equations allow us to compute the following:</p> <ul> <li><p><em>For <a href="http://en.wikipedia.org/wiki/Half_precision" rel="noreferrer">half precision</a>...</em></p> <p>If you want an accuracy of +/-0.5 (or 2^-1), the maximum size that the number can be is 2^10. Any larger than this and the distance between floating point numbers is greater than 0.5.</p> <p>If you want an accuracy of +/-0.0005 (about 2^-11), the maximum size that the number can be is 1. Any larger than this and the distance between floating point numbers is greater than 0.0005.</p></li> <li><p><em>For <a href="http://en.wikipedia.org/wiki/Single_precision" rel="noreferrer">single precision</a>...</em></p> <p>If you want an accuracy of +/-0.5 (or 2^-1), the maximum size that the number can be is 2^23. Any larger than this and the distance between floating point numbers is greater than 0.5.</p> <p>If you want an accuracy of +/-0.0005 (about 2^-11), the maximum size that the number can be is 2^13. Any larger than this and the distance between floating point numbers is greater than 0.0005.</p></li> <li><p><em>For <a href="http://en.wikipedia.org/wiki/Double_precision" rel="noreferrer">double precision</a>...</em></p> <p>If you want an accuracy of +/-0.5 (or 2^-1), the maximum size that the number can be is 2^52. Any larger than this and the distance between floating point numbers is greater than 0.5.</p> <p>If you want an accuracy of +/-0.0005 (about 2^-11), the maximum size that the number can be is 2^42. Any larger than this and the distance between floating point numbers is greater than 0.0005.</p></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload