Decimal number to fraction of 16 like measuring tape

I want to change decimal into fraction like this
10.5 then the label should show 10 8/16
10.375 then the label should show 10 6/16
10.4375 then the label should show 10 7/16
Like a Measuring Tape.
Please sir tell me how to do it

Mathematics.