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.

  • 7
    $\begingroup$ It's probably easiest to just add it as a fractional term if you need arbitrary precision 12/100+(34/99)/100. $\endgroup$
    – eyorble
    Feb 25 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[]:


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


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


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

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


FromDigits[{{0, 0, 0, {1, 1, 0, 0}}, 0}, 2]
  • 1
    $\begingroup$ Thank you very much. $\endgroup$ Feb 25 at 2:04

Use the Resource Function

ResourceFunction["RepeatingDecimalToRational"][0.3, 1]

(* 1/3 *)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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