Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float a = someValue;
- int b = someOtherValue;
- int c = 0;
- while (a <= -b / 2) {
- c--;
- a += b;
- }
- while (a >= b / 2) {
- c++;
- a -= b;
- }
- c = floor((a+b/2)/b)
- a = a - c*b
- x = (a+b/2)/b
- y = (a-b/2)/b
- c = (x≤0)*(ceiling(x) - 1 + (x is integer))
- +(y≥0)*(1 + floor(y))
- c = (int)((a - (b / 2)) / b + 1);
- a -= c * b;
- c = ((int) a + b / 2 * sign(a)) / b
Add Comment
Please, Sign In to add comment