I don't think there is a simple way to find out if a number is periodic. But then again, I didn't study mathematics. This might be a start (maybe not the best though):

Using 1/3 as an example, devide 1 by 3 (in integers, always rounded down [floor]). The result is 0. So you know you have a "0 point something" number.

Now get the mod, 1%3 which is 1. Multiplying this with 3 again gives you your second digit: 3. To get the next one you would have to devide the mods result by 3 again. You know you already did this and that it left you with a mod of 1, so you know you're stuck in an endless loop. 0.33333333333333....

To find a pattern like 0.545854585458 would require you to keep track of multiple results though. After each run you compare your buffers first n/2 elements with the remaining ones. If they match, you found a sequence and can stop there.

Of course, you could just do the ugly thing and convert the float result into a string and search for a pattern as described above, but that limits you to FP precision. Which is bad.

I hope this helps somewhat.

(btw grats thantos for removing your post so quickly

)