Please contact us if you have any trouble resetting your password.
How about r^2 / (max(d,0) + r)^2 to fix infinity problem?