### Repeating decimal numbers

Is there a way to know if a given number has got a repeating part?
What is the repeating part?
fpiro, it would be very helpful if you'd give an example.

12535 has a repeating part-- 5.

3866556 has two repeating parts-- 66 and 55

3579728712972885 has a repeating part-- 972

The result of dividing 481486 by 37 has a repeating part-- the 135 in 13013.135135135135135135135...

Lamice
I'm sorry, I didn't explain myself well.

I was talking about the repeating part of floating point numbers, for example "1.22222222222", "0.3333333333" and so on.

If the user inputs one of those numbers, how can I know whether the number is repeating or not?
I don't know if there is a way. For one thing, the floating point numbers are stored internally using binary, so that decimal 0.1 ends up with a repeating representation internally. Therefore, you are most likely interested only in whether the decimal representation repeats.
For example, 1/7 = 0.142857142857142857...
and 1/17 = 0.058823529411764705882352941176470...
But in the general case, you are likely to run out of precision before you are able to check this properly.
 If the user inputs one of those numbers, how can I know whether the number is repeating or not?

That's impossible. You're asking me, the user to input a number. I input this number:

0.3333333

Can YOU tell me now if I mean one third (i.e. repeating), or if I actually mean exactly 0.3333333? You cannot. There is no way to know. You cannot program something that's impossible.
I think I'm gonna write a class to implement those numbers.

There actually is one of these things in mathLab.

Thank you for your help, anyway.
Topic archived. No new replies allowed.