  This paper reviews the standard algorithm for converting spacecraft state
vectors to Keplerian orbital elements with a focus on its computer
implementation. It analyzes the shortcomings of the scheme as described in the
literature, and proposes changes to address orbits of arbitrary eccentricity
and inclination in a robust way. Next, it presents two alternative schemes that
simplify the program structure while improving the accuracy and speed of the
transformation on modern computer architectures. Comprehensive numerical
benchmarks demonstrate accuracy improvements by two orders of magnitude,
together with a 40% reduction of computational cost relative to the standard
implementation.
