title: What's the maximum precision (after the decimal point) of a float in Javascript
body: <p>An algorithm I'm using needs to squeeze as many levels of precision as possible from a float number in Javascript. I don't mind whether the precision comes from a number that is very large or with a lot of numbers after the decimal point, I just literally need as many numerals in it as possible.</p>
  <p>(If you care why, it is for a <a href="https://softwareengineering.stackexchange.com/questions/195308/storing-a-re-orderable-list-in-a-database">drag n' drop ranking algorithm</a> which has to deal with a lot of halvings before rebalancing itself. I do also know there are better string-based algorithms but the numerical approach suits my purposes)</p>
  <p>The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number" rel="nofollow noreferrer">MDN Docs say that</a>:</p>
  <blockquote>
  <p>The JavaScript Number type is a double-precision 64-bit binary format IEEE 754 value, like double in Java or C#. This means it can represent fractional values, but there are some limits to what it can store. A Number only keeps about 17 decimal places of precision; arithmetic is subject to rounding.</p>
  </blockquote>
  <h3>How should I best use the &quot;17 decimal places of precision&quot;?</h3>
  <p>Does the 17 decimal places mean &quot;17 numerals in total, inclusive of those before and after the decimal place&quot;</p>
  <p>e.g. (adding underscores to represent thousand-separators for readability)</p>
  <pre class="lang-sh prettyprint-override"><code># 17 numerals: safe
  111_222_333_444_555_66
  
  # 17 numerals + decimal point: safe
  111_222_333_444_555_6.6
  1.11_222_333_444_555_66
  
  # 18 numerals: unsafe
  111_222_333_444_555_666
  
  # 18 numerals + decimal point: unsafe
  1.11_222_333_444_555_666
  111_222_333_444_555_66.6
  </code></pre>
  <p>I assume that the precision of the number determines the number of numerals that you can use and that the position of the decimal point in those numerals is effectively academic.</p>
  <ul>
  <li>Am I thinking about the problem correctly?</li>
  <li>Does the presence of the decimal point have any bearing on the calculation or is it simply a matter of the number of numerals present</li>
  <li>Should I assume that 17 numerals is safe / 18 is unsafe?</li>
  <li>Does this vary by browser (not just today but over say, a 10 year window, should one assume that browser precision may increase)?</li>
  </ul>