Comment by benjoffe

5 hours ago

Hello, you are correct that part of it is done to death for standard integer division.

The `new` thing is the range-splitting which achieves the floor division for negative inputs (eg. sign-selected for 60% of divisors, and the negative/positive bump for the remaining 20%/20% of cases each).

I found this by accident because I wanted to speed up a part on my Pebble watch face, I didn't even know the history of past attempts. The floor variant was born out of a particular rounding optimisation attempt that felt like it could be easier if I just use floor/ceil and moved it into a large int-multiplication space. (this is very tempting because certain constants for rendering and angle calculations are based around large integer constants on that platform, kinda doing half the work towards this idea by creating this particular constraint)