atan is a very poor implementation for atan2.