Is there is a simple, pythonic way of rounding to the nearest whole number without using floating point? I\'d like to do the following but with integer arithmetic:
Simply take care of the rounding rule before you ever divide. For the simplest round-half-up:
if total % surplus < surplus / 2: return total / surplus else: return (total / surplus) + 1
Tweak a little bit if you need to do a proper round-to-even.