14
$\begingroup$

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

$\endgroup$
  • 8
    $\begingroup$ Rationalize[0.1845095405274387, 10^-50] ? $\endgroup$ – Dr. belisarius Jun 20 '12 at 1:07
9
$\begingroup$

Another option:

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

Still another possibility:

Last[Convergents[0.1845095405274387]]
$\endgroup$
  • 1
    $\begingroup$ +1 for referencing a non-esoteric function I cannot recall using. $\endgroup$ – Mr.Wizard Jun 22 '12 at 2:02
  • $\begingroup$ I deal with continued fractions somewhat frequently, you see... $\endgroup$ – J. M. will be back soon Jun 22 '12 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$
  • $\begingroup$ @Mr.Wizard...I Thank you $\endgroup$ – emmett Jun 20 '12 at 2:08

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.