For the 'log' approach, to avoid the problem with x,y << 1, you can simply check if x,y<1 and then proceed:
if at least one of them is less than one, (and assuming that both x,y < max which I think can be assumed from the problem) , then we're fine
(no need to worry about log(x) tending to...