View Single Post
Old 09-21-2006, 01:10 PM   #3 (permalink)
xepherys
<3 TFP
 
xepherys's Avatar
 
Location: 17TLH2445607250
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
xepherys is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76