I knew about the infamous Binary Search bugs in books, and I dared to write the first bug-free implementation in my book, very carefully. Still, it ended up having bugs. :) Luckily, Manning's early access program let me fix them before printing.
I find this topic really interesting, thanks for sharing. I doubt I could code a binary search without any bugs from scratch :)