It doesn't work if you keep zooming in, eventually (after a lot of zooming) it gets pixelated, maybe there's some floating point rounding going on?
One could do better with arbitrary-precision arithmetic, but I wanted to keep the code small and simple - and also thought this is a neat illustration of why double-precision numbers are really not the same as reals.