An implementation of arctan2