title: Find arithmetic progression between two numbers
body: <p>I have two numbers and I need to find an arithmetic progression between those two numbers in such a way it should always contain number <strong>zero</strong>.  </p>
  
  <p>Below is my code.</p>
  
  <pre><code>var numberOfPoints = 6;
  var min = -5;   
  var max = 10;
  var step = (max - min) / numberOfPoints;
  var pointsArray = [min];
  var point = min;
  for (var i = 0; i &lt; numberOfPoints; i++) {
     point = point + step;
     pointsArray.push(+point.toFixed(2));
  }
  console.log(pointsArray); //[-5, -2.5, 0, 2.5, 5, 7.5, 10]
  </code></pre>
  
  <p>Code works fine.   </p>
  
  <p>But if I change <code>min = -7</code>, I get the <code>[-7, -4.17, -1.33, 1.5, 4.33, 7.17, 10]</code> which is missing <strong>zero</strong>.  </p>
  
  <p>Following is the situation  </p>
  
  <ol>
  <li><code>numberOfPoints</code> is fixed <code>min</code> and <code>max</code> varies.</li>
  <li><code>min</code> is always negative <code>max</code> may or may not be negative.</li>
  <li><code>A negative threshold value</code> can be added to <code>min</code> to get an arithmetic progression having number <strong>zero</strong> in it.</li>
  </ol>