I have two simple while loops in my program that I feel ought to be math equations, but I\'m struggling to convert them:
float a = someValue; int b = someOtherVa
I think you want something like this:
c = ((int) a + b / 2 * sign(a)) / b
That should match your loops except for certain cases where b is odd because the range from -b/2 to b/2 is smaller than b when b is odd.