keep cosA within range for acos