I am not sure about this, but would this possibly lead to errors when e.g. x is a very large negative number? An If statement dealing with x>0 cases and x<0 cases might be helpful (although it may hurt performance).