[Tutor] Need more precise digits
Mike Yuen
myuen@ucalgary.ca
Sat, 1 Dec 2001 13:22:35 -0700 (MST)
I've trying to calculate an average and it looks like i'm losing some
precision in digits.
For example: i've got the following formula
avgsize = float(totalsize/groups)
both totalsize and groups are integers
I've got 10 groups
sizes are:
2+3+2+2+3+2+2+2+2+2 = 22
I should get 22/10 = 2.2.
What I get is 2.0. How do I get this missing 2 tenths? As you can see
from the above, I already casted to a float.
Thanks,
M