how do i turn the decimal into a fraction ?
Have a look at the number of zeros. E.g.:
0.5 = 5/10
0.05 = 5/100
0.005 = 5/1000
and so on...