You could also force it to always only look at 2 decimal places. If you are doing a calculation to say add two numbers (not likely where your math goes wonky, but it works just the same), instead of doing:
$sum = $a + $b
you can do something like:
$sum = round($a, 2) + round($b, 2)
The above example is in PHP, but I'm sure C has a similar function. This will round $a to say, 13.46 instead of 13.46000000 or 13.46000001234542 and will perform the math on that value.
__________________
The prospect of achieving a peace agreement with the extremist group of MILF is almost impossible...
-- Emmanuel Pinol, Governor of Cotobato
My Homepage
|