migrate libnum to cargo package