bcadd really necessary when calculating shopping cart total?
<p>Given the fact that a floating point is imprecise and that I should use the the BCMath function to get precise results, is it really necessary to use price strings in PHP and add them up with bcadd when making a 'simple' shopping cart?</p>

<p>Given the following example, why shouldn't I use a rounded float?</p>

<p>I'm looking for a best practice for calculating the order total for a shopping cart.</p>

<pre><code>    $floatTotal = 0.00;
$stringTotal = '0.00';

for($i=0; $i&lt;1000; $i++) {
    $floatTotal += 0.1; 
}
echo "float value: ";
printf('%.40f', $floatTotal); //99.9999999999985931253831950016319751739502

echo "&lt;br&gt;\n";

echo "rounded float value: ". round($floatTotal); //100

echo "&lt;br&gt;\n";

for($i=0; $i&lt;1000; $i++) {
    $stringTotal = bcadd($stringTotal, '0.1', 2);
}

echo 'string value: '.$stringTotal.'&lt;br&gt;'; //100.00
</code></pre>
