Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question
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

If you only deal with finite digits then you can simply start with a 1, and then start at the dot and interchange the digits from left right.

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.

share|cite|improve this answer
I want the resultant integer to be small like 4 numerals – peter Nov 23 '12 at 15:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.