in PHP
echo (int) ( (0.1+0.7) * 10 );
or in Ruby
p ((0.1+0.7) *10).to_i
the result is 7 instead of 8. it might be really hard to catch for such pitfalls. i think if in North America, it is less of a problem because we calculate prices up to how many cents, so $17.28 or $17.29 might be less of a problem. But in country like China or Hong Kong, the price can be just an integer. In this case, if our program is generous and just ask the customer for the integer portion of the price, then problems can arise if 8 becomes 7. So maybe we always need to be careful and use round() instead? Any other method avoid this pitfall?