# How to enter a repeating decimal in Mathematica

I don't understand how to manipulate numbers with repeating decimal in Wolfram Mathematica language.

For example 0.3... does not work as input and I don't see how to add a vinculum to indicate the repeating part either. There's no manual or something on the issue on the net. Something strange and unusable 0.12(34)^_ (repeating decimal) is given by Wolfram Alpha.

• It's probably easiest to just add it as a fractional term if you need arbitrary precision 12/100+(34/99)/100. Feb 25, 2021 at 1:16

Indeed, there is no direct method to input a repeating decimal. The closest you can get is to input the repeating digits into FromDigits[]:

$$0.\overline{142857}$$

FromDigits[{{{1, 4, 2, 8, 5, 7}}, 0}]
1/7


$$0.\overline{3}$$

FromDigits[{{{3}}, 0}]
1/3


$$0.1\overline{6}$$

FromDigits[{{1, {6}}, 0}]
1/6


Of course, this also applies for e.g. repeating binary representations:

$${0.000\overline{1100}}_2$$

FromDigits[{{0, 0, 0, {1, 1, 0, 0}}, 0}, 2]
1/10

• Thank you very much. Feb 25, 2021 at 2:04
ResourceFunction["RepeatingDecimalToRational"][0.3, 1]

(* 1/3 *)


I'm not sure if WolframAlpha notation is identical with Mathematica, although in the question you look like you used the 0.12343434... (3 dots), but in WolframAlpha (this is how I got to this question), you can use:

0.123434..


for 0.12(34)

WolframAlpha and Mathematica should be the same software under the covers having Steven Wolfram as creator. If not, I will let it as reference for those looking for WolframAlpha equivalent.

• This may be not a repeating decimal. You do not know what numbers come after. Aug 11, 2023 at 19:24
• For what it's worth, 0.123434.. does NOT work in Mathematica to represent a number with repeating digits. The expression 0.123434 .. just the same as Repeated[0.123434] which is a pattern. I.e. MatchQ[{0.123434, 0.123434, 0.123434}, {Repeated[0.123434]}] would return True. Aug 11, 2023 at 20:07
• Thank you @lericr. I understand and agree with you (+1). Do you think it worth leaving this answer only for context and equivalence for WolframAlpha ? Thank you @Валерий Заподовников (+1)! Aug 11, 2023 at 20:41
• My recommendation would be to delete it, but it's a judgment call and I'm fine either way. Aug 11, 2023 at 21:09