# reducing a number with fractions

I'm trying to come up with a formula to reliably reduce a number like NNN.NNNN to a simple integer – NNNN such that NNNN can be converted back to NNN.NNNN as it were before using the inverse of the same formula.

Would be grateful if you could provide some formula or pointers in that direction.

-
If you know how many Ns there are after the decimal point, you can just multiply with an appropriate power of $10$. – Gregor Bruns Nov 23 '12 at 15:20
@peter: Can you provide more specifics? Also, what is the application? I can imagine some things you might be trying to do for which there is a much simpler way than trying to solve the mathematical problem you are trying to describe. – Hurkyl Nov 23 '12 at 15:21
Do you mean you want to convert a "terminating" decimal number to a fraction? – DavidC Nov 23 '12 at 15:29

For example $13212.312$ becomes $1231122301$. You need to start with a 1, just in case the last digit of the number is 0. Going back is easy.
If you original number is any real number, such a formula cannot exist since $\mathbb R$ is uncountable.