title: php intval() and floor() return value that is too low?
body: <p>Because the float data type in PHP is inaccurate, and a FLOAT in MySQL takes up more space than an INT (and is inaccurate), I always store prices as INTs, multipling by 100 before storing to ensure we have exactly 2 decimal places of precision. However I believe PHP is misbehaving. Example code:</p>
  
  <pre><code>echo "&lt;pre&gt;";
  
  $price = "1.15";
  echo "Price = ";
  var_dump($price);
  
  $price_corrected = $price*100;
  echo "Corrected price = ";
  var_dump($price_corrected);
  
  
  $price_int = intval(floor($price_corrected));
  echo "Integer price = ";
  var_dump($price_int);
  
  echo "&lt;/pre&gt;";
  </code></pre>
  
  <p>Produced output:</p>
  
  <pre><code>Price = string(4) "1.15"
  Corrected price = float(115)
  Integer price = int(114)
  </code></pre>
  
  <p>I was surprised. When the final result was lower than expected by 1, I was expecting the output of my test to look more like:</p>
  
  <pre><code>Price = string(4) "1.15"
  Corrected price = float(114.999999999)
  Integer price = int(114)
  </code></pre>
  
  <p>which would demonstrate the inaccuracy of the float type. But why is floor(115) returning 114??</p>