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

(int32_t)3975308642 == -319658654

Overflow makes intuitive arithmetic do unusual things.

Similarly, using a+b/2 for binary search midpoints is wrong. http://googleresearch.blogspot.com/2006/06/extra-extra-read-...



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

Search: