<div>Somehow I don't see my own answer in “Sent”, so here it is once again:<br></div><div><br data-mce-bogus="1"></div><div>For `/` being the integer division in C and for the nonnegative integers, I agree. Also ceil(i * a / b) = i / b * a + (i % b * a - 1) / b + 1 (if b is zero, both sides are undefined anyway).<br data-mce-bogus="1"></div><div><br></div><blockquote><div>11.03.2024, 05:35, Tomas Rokicki <<a href="mailto:rokicki@gmail.com" target="_blank" rel="noopener" data-mce-href="mailto:rokicki@gmail.com">rokicki@gmail.com</a>></div><div id="part2" class="messageBodyContainer"><div class="messageBody"><div class="RMCrWspDV1Nqd"><div dir="ltr">I did notice that code, but I think I prefer the less opaque version:<div><br></div><div>   ceil(i * a / b) = i / b * a + (i % b * a + b - 1) / b</div><div><br></div><div>which is also overflow-free given our current values of a and b.</div><div><br></div><div>Do you disagree?</div></div></div><br></div></div></blockquote>