Run if (or similar) statement once

Would using floats solve this problem, as opposed to integers

Yes. The tradeoff is that float division is a lot slower than integer division.