You will need
- the ability to reduce fractions
If the denominator is 10, 100, or, in General, 10^n, where n is a natural number, then this fraction can be written as a decimal. The number of digits after the decimal point defines the denominator of such fraction. It is equal to 10^n, where n is the number of characters. So, for example, 0.3 mm can be written as 3/10, or 0.19 as 19/100, etc.
In some cases the resulting fraction can be reduced. For example, 0,5 = 5/10. Use the rules of reduction of fractions and divide the numerator and the denominator by the common factor of these numbers is 5. As a result, you will receive: 0,5 = 5/10 = 1/2.
Suppose now that the integer part of a decimal number not equal to zero. Then this number can be translated either into an improper fraction, where the numerator more than the denominator, or a mixed number. For example: 1,7 = 1+(7/10) = 17/10, 2,29 = 2+(29/100) = 229/100.
If at the end of a decimal fraction is one or more zeros, these zeros can be discarded, and transfer the number with the remaining number of decimal places in the fractional. Example: 1,7300 = 1,73 = 173/100.