title: Math.min/max.apply set values as percent of new range
body: <p>I have an array list of values</p>
  
  <pre><code>var v=[0.009865,0.009866,0.009309,0.009831,0.009919,0.009965,0.009806,0.009509,0.009731,0.009888];
  </code></pre>
  
  <p>I calculate the min,max and difference between the two to make the range</p>
  
  <pre><code>var max=Math.max.apply(this,v)/100;
  var min=Math.min.apply(this,v)/100;
  var dif=max-min;
  
  console.dir({'max':max,'min':min,'dif':dif});
  </code></pre>
  
  <p>the console.dir shows</p>
  
  <pre><code>max: 0.00009965
  min: 0.00009308999999999999
  dif: 0.000006560000000000005
  </code></pre>
  
  <p>Then I loop through each value attempting to convert them into percentages inside the range </p>
  
  <p><strong>(by finding out how larger the current value is than the min, dividing the answer by the dif and multiplying the result by 100 to get the percent)</strong></p>
  
  <pre><code>for (var i=0;i&lt;v.length;i++){
      v[i]=((v[i]-min)/dif)*100;
      console.log(v[i]);
      }
  </code></pre>
  
  <p>the console.log shows values I really don't expect to see (expected between 0-100)</p>
  
  <pre><code>148962.04268292672
  148977.28658536574
  140486.43292682915
  148443.74999999985
  149785.21341463405
  150486.43292682915
  148062.65243902427
  143535.21341463405
  146919.35975609746
  149312.65243902427
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>My reference to the math: <a href="https://math.stackexchange.com/questions/51509/how-to-calculate-percentage-of-value-inside-arbitrary-range">https://math.stackexchange.com/questions/51509/how-to-calculate-percentage-of-value-inside-arbitrary-range</a></p>