How can I express a decimal such as 0.1845095405274387 as a fraction in its lowest terms?
3 Answers
Still another possibility:
Last[Convergents[0.1845095405274387]]
-
1$\begingroup$ +1 for referencing a non-esoteric function I cannot recall using. $\endgroup$ Jun 22, 2012 at 2:02
-
$\begingroup$ I deal with continued fractions somewhat frequently, you see... $\endgroup$ Jun 22, 2012 at 2:04
A couple of bits of code for your consideration:
FromDigits@#/10^(Length@# - #2) & @@ RealDigits[0.1845095405274387]
Rationalize[0.1845095405274387, $MachineEpsilon]
Rationalize[0.1845095405274387, 10^-50]
? $\endgroup$