Inverse kinematics solutions are the basis for position and orientation control of automated machines in their Cartesian workspace. This paper presents an efficient and robust inverse kinematics algorithm for a new circumferential drilling machine for aircraft fuselage assembly. After a brief introduction to the circumferential drilling machine and its forward kinematics, the paper discusses the nonlinear optimization method for solving inverse kinematics problems. The objective function is defined as a weighted combination of a position error function and an orientation error function. By representing orientation error as the geodesic distance between two points on a unit sphere, the paper proposes to define the orientation error function by using faithful geodesic distance functions, which are accurate approximations to the geodesic distance when it is small. For increased efficiency, robustness, and easy setting of initial values, the inverse kinematics problem is decomposed into two subproblems. The revolute joint coordinates are obtained by nonlinear optimization, and the prismatic joint coordinates are calculated with closed-form formulas. Numerical experiments show that the objective function defined with faithful geodesic distance functions is effective, and the proposed algorithm is efficient, robust, and accurate. The algorithm has been successfully integrated into the control system of the circumferential drilling machine. Preliminary drilling experiments show that the position accuracy of drilled holes is within ±0.5 mm, which is acceptable for the assembly of large aircrafts.