15
$\begingroup$

How can I express a decimal such as 0.1845095405274387 as a fraction in its lowest terms?

$\endgroup$
1
  • 8
    $\begingroup$ Rationalize[0.1845095405274387, 10^-50] ? $\endgroup$ Jun 20, 2012 at 1:07

3 Answers 3

9
$\begingroup$

Another option:

RootApproximant[0.1845095405274387, 1]
$\endgroup$
8
$\begingroup$

Still another possibility:

Last[Convergents[0.1845095405274387]]
$\endgroup$
2
  • 1
    $\begingroup$ +1 for referencing a non-esoteric function I cannot recall using. $\endgroup$
    – Mr.Wizard
    Jun 22, 2012 at 2:02
  • $\begingroup$ I deal with continued fractions somewhat frequently, you see... $\endgroup$ Jun 22, 2012 at 2:04
7
$\begingroup$

A couple of bits of code for your consideration:

FromDigits@#/10^(Length@# - #2) & @@ RealDigits[0.1845095405274387]

Rationalize[0.1845095405274387, $MachineEpsilon]
$\endgroup$
1
  • $\begingroup$ @Mr.Wizard...I Thank you $\endgroup$
    – emmett
    Jun 20, 2012 at 2:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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