+ 1

How to check if the number is a repeating decimal?

As said in the question, I need something that can give me a boolean value that is either true or false according to the number. For example 7,7777... or 4,123123123... would return true. And 5,5 would return false.

10th Sep 2019, 4:06 PM
Frosty
10 Answers
+ 2
Convert decimal to string and then you can see if next or previous number is same then number is repeate.
10th Sep 2019, 4:14 PM
yogesh lodha
yogesh lodha - avatar
10th Sep 2019, 7:52 PM
Anton Böhler
Anton Böhler - avatar
0
if you know the two numbers that generate the fraction you can find out if it is repetative or not. this is probably even better than converting to String ..
10th Sep 2019, 4:17 PM
Anton Böhler
Anton Böhler - avatar
0
But 4,5425 is not something repeating
10th Sep 2019, 4:18 PM
Frosty
0
Or what if the number is 4,542542... ? Previous or next number is not repeated yogesh lodha Anton Böhler
10th Sep 2019, 4:38 PM
Frosty
0
Logic will be previous and next number. But you need to check 2 number group and then 3 number group
10th Sep 2019, 4:48 PM
yogesh lodha
yogesh lodha - avatar
0
yogesh lodha What if the number is repeating 4 digits? I need something that checks if the number is repeating and goes forever or not
10th Sep 2019, 4:49 PM
Frosty
0
You need to check number list N/2 If 24466975 there is 4 number group need to check
10th Sep 2019, 4:53 PM
yogesh lodha
yogesh lodha - avatar
0
I didn't get ya. Can you write the code that is able to do what I asked?
10th Sep 2019, 4:55 PM
Frosty
0
Tysm
10th Sep 2019, 8:09 PM
Frosty