why count the price is not right when the qty equals 10?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/588004/is-javascripts-math-broken">Is JavaScript’s Math broken?</a>  </p>
</blockquote>



<p>from this question:
<a href="http://stackoverflow.com/questions/13486148/get-all-the-input-value-and-make-an-addition">get all the input value and make an addition</a></p>

<p>there is a promotion:</p>

<p>buy 1 each price is 14.37, buy 10 the price is 13.28, buy 20 each price is 10.78.....</p>

<p>now i want to do a counter.<a href="http://down123.xxmn.com/count.htm" rel="nofollow">http://down123.xxmn.com/count.htm</a></p>

<p>the counter write the whole price.now, there is something wrong with my code.</p>

<p>if i fill 5 in an input box, then fill 5 in another input box. the whole price isn't 132.8. why?</p>

<p>if i remove a number in an input box, the whole price doesn't change. thank you</p>

<p>the code:</p>

<pre><code>var $inputs = jQuery('.liste_couleur_qty li input');
$inputs.keyup(function() {
   var result = 0;
   $inputs.each(function(){
     result += parseInt(this.value, 10);
   });
   var JsonData =[{"price_id":"1","website_id":"0","price_qty":1,"price":"14.37"},
 {"price_id":"2","website_id":"0","price_qty":10,"price":"13.28"},
 {"price_id":"3","website_id":"0","price_qty":20,"price":"10.78"}, 
  {"price_id":"3","website_id":"0","price_qty":50,"price":"9.23"},
   {"price_id":"3","website_id":"0","price_qty":100,"price":"7.91"}
 ]
   var sorted = JsonData.sort(function(a,b){return a.price_qty - b.price_qty;});

var i=0;
while(i &lt; sorted.length &amp;&amp; sorted[i].price_qty &lt;= result){i++;} 

var price = sorted[i-1].price;

   price= price*result;

   jQuery('#qtyvalue').html("Total price is " + price);    
});
</code></pre>

<p>now, when the qty is 9, the right price is 9*14.37. but my counter is not right.</p>
