> First, you really don't want to do that division x/y, which is slow, and which fails if y==0. It's much cheaper and safer to compare "abs(x-y) < 1e-10*y".
I might be missing something, but won't your cheaper and safer fragment also fail when y is zero (or negative)?