I'm writing a simulator which uses US currency (pennies, nickels, dimes, quarters, and half-dollars). The implementation is something like this:
B = B_0;
While not done:
B += simulate(strategy, investment);
I'd like to avoid floating-point while not having to make expensive checks for overflows (like B < INT_MAX). Is there a quick and accurate way to use integers-only here?