The reason this doesn't work is that you're doing the "+5" after the int statement. The purpose of the +5 (or +0.5) is to ensure that the int rounds down anything below x.5 and rounds up anything x.5 and above.
It's so that:
int(0.4 + 0.5) = int(0.9) and therefore 0.4 rounds down to 0.
int(0.5 + 0.5) = int(1.0) and therefore 0.5 rounds up to 1.
How I long for the good old days of MC68000 programming, where there was no such thing as floating point :)
In reply to Re: (4) Dividing and format
by TheFluffyOne
in thread Dividing and format
by hotshot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |