This is a good theory but the basic maths is that 1 mile = 1 km * 1.6 or vice versa. This is the basic thing you need to do.
However, this can get confusing it it get's to odd numbers etc, so what you can do is, simple leave it as miles because if you are in a miles country no one is converting it to km or vice versa.
Same with C and F in temperatures, there are basic maths systems that can do this in constant time, so there is no real reason to complicate it unless you want to do it in your head and then there is the basic maths to do it, if you can't just use a calculator.
However, this can get confusing it it get's to odd numbers etc, so what you can do is, simple leave it as miles because if you are in a miles country no one is converting it to km or vice versa.
Same with C and F in temperatures, there are basic maths systems that can do this in constant time, so there is no real reason to complicate it unless you want to do it in your head and then there is the basic maths to do it, if you can't just use a calculator.