I basically want to know whether the result of my equation (which is a simple one like this x / y
) was rounded up or down.
The reason is that I have two simple statements after the rounding line like this:
if h % 2 != 0: h = h + 1
if h % 4 != 0: h = h + 2
and based on the direction of the rounding I would choose the +
or -
operator, so if the result was rounded up and h % 2 != 0
then it would be h = h + 1
and if it was rounded down then h = h - 1
.
Does round()
give that kind of information?
Also, is my math correct? (I want the result to be dividable by 4)