News for hackers. Stuff that matters.
Re:Figuring out round, floor and ceil with integer division by fay59 on Saturday November 26, 2022 @04:19AM (#33751236)
> We could stop right here but this suffers from overflow limitations if translated into C.

FWIW, the final version also suffers from integer overflow limitations. If the difference between an and INT_MIN/INT_MAX (depending on whether you floor or ceil) is <= b/2, you will have integer overflow.

Re:Figuring out round, floor and ceil with integer division by jepler on Saturday November 26, 2022 @11:49AM (#33754228)
I thought the same might be true, and a theorem prover agrees with us: https://gist.github.com/jepler/eda8401d1b613c44376dc8148fcf9...
Re:Figuring out round, floor and ceil with integer division by ux on Saturday November 26, 2022 @04:17PM (#33756836)
Thank you for pointing this out. I added a note about this.