Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The insight here is that, for unsigned values, rounding down to a multiple of N is cheaper than rounding up to a multiple of N.

In addition to simpler arithmetic, rounding down always succeeds - 0 is a multiple of all N - while rounding up may fail if a larger multiple does not exist. So you need to check in the round-up case.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: