title: Is it correct to state that the first number that collide in single precision is 131072.02? (positive, considering 2 digits as mantissa)
body: <p>I was trying to figure it out for my audio application if <code>float</code> can be used to represent correctly the range of parameters I'll use.</p>
  
  <p>The "biggest" mask it needs is for frequency params, which is positive, and allow max two digits as mantissa (i.e. from 20.<em>00</em> hz to 22000.<em>00</em> hz). Conceptually, the following digits will be rounded out, so I don't care for them.</p>
  
  <p>So I made this <a href="http://coliru.stacked-crooked.com/a/58ce6007e007c80a" rel="nofollow noreferrer">script</a> to check the first number that collide in single precision:</p>
  
  <pre><code>float temp = 0.0;
  double valueDouble = 0.0;
  double increment = 1e-2;
  
  bool found = false;
  while(!found) {
      double oldValue = valueDouble;
      valueDouble += increment;
      float value = valueDouble;
  
      // found
      if(temp == value) {
          std::cout &lt;&lt; "collision found: " &lt;&lt; valueDouble &lt;&lt; std::endl;
          std::cout &lt;&lt; "   collide with: " &lt;&lt; oldValue &lt;&lt; std::endl;
          std::cout &lt;&lt; "float stored as: " &lt;&lt; value &lt;&lt; std::endl;
          found = true;
      }
  
      temp = value;        
  }
  </code></pre>
  
  <p>and its seems its <code>131072.02</code> (with <code>131072.01</code>, stored as the same <code>131072.015625</code> value), which is far away than 22000.00. And it seems I would be ok using float. </p>
  
  <p>But I'd like to understand if that reasoning is correct. It is?</p>
  
  <p>The whole problem would be if I set a param of XXXXX.YY (<code>7 digits</code>) and it collides with some other numbers having a less number of digits (because <code>single precision</code> only guarantee <code>6 digits</code>)</p>
  
  <p>Note: of course numbers such as <code>1024.0002998145910169114358723163604736328125</code> or <code>1024.000199814591042013489641249179840087890625</code> collide, and they are within the interval, but they do it at a longer significative digits than my required mantissa, so I don't care.</p>