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

It's a side effect of two's complement representation of integers. There ought to be a repository somewhere for neat tricks like this (with a warning never to use them in production).

    FOR ENTERTAINMENT PURPOSES ONLY


There is, and I can't recommend it highly enough.

http://www.amazon.com/Hackers-Delight-2nd-Henry-Warren/dp/03...


Was going to recommend Hacker's Delight, and saw I was too late :)


One of the "tadpole" operators is actually on the cover right above "Delight".


I own this book, and it is fantastic.

There's also HAKMEM[1] and the FXT book[2].

[1]: http://www.inwap.com/pdp10/hbaker/hakmem/hakmem.html [2]: http://www.jjj.de/fxt/




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

Search: