When distances are vast, too much rounding can result in substantial errors. Since our computer is capable of working with very precise numbers with an error factor of around 10 to the minus 15, we should write the most precise numbers available into our constants.
1 foot = 0.3048 meters
Given that significant figures is a part of scientific calculation, we can arbitrarily multiply both sides by 1000 so both values have four significant figures.
1000 feet = 304.8 meters.
Now we know that one mile is 5280 feet.
5280 / 1000 = 5.280
1 mile = 5.280 * 304.8 meters => 1609.344 meters
Here is where sigdigs come around to bite us. There are way more digits in the result than we can use in a published solution. But we are talking about vast distances so lets arbitrarily increase 1 mile to 1 thousand miles.
1000 miles = 1609344 meters
Now we can round out the significant figures in our result to 1.609 * 10 ** 6.
1609 kilometers is 344 meters short of 1000 miles.
The point here is that our conversion factors should be as precise as we can make them, and rounding left to the last step, when we publish our solution.
1.609344 kilometers = 1 mile
The same would apply to converting from kilometers to miles. Write the best number you have in your conversion factors and let the function return as nearly precise a value as possible, then let the rounding happen as needed to meet sigdig requirements. Don’t round conversion factors or your program will never output more than an estimation of approximate conversion.