proper implementation of arctan