title: Algorithm for simplifying decimal to fractions
body: <p>I tried writing an algorithm to simplify a decimal to a fraction and realized it wasn't too simple.</p>
  <p>Write <code>0.333333...</code> as <code>1/3</code> for example.</p>
  <p>Or <code>0.1666667</code>, which is <code>1/6</code>.</p>
  <p>Surprisingly I looked online and all the codes I found where either too long, or wouldn't work in some cases. What was even more annoying was that they didn't work for recurring decimals. I was wondering however whether there would be a mathematician/programmer here who understands all the involved processes in simplifying a decimal to a fraction. Anyone?</p>