Expressing a decimal as a fraction in lowest terms

14

2

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

emmett

Posted 2012-06-20T01:01:08.990

Reputation: 349

8Rationalize[0.1845095405274387, 10^-50] ? – Dr. belisarius – 2012-06-20T01:07:31.600

Answers

9

Another option:

RootApproximant[0.1845095405274387, 1]

Simon Woods

Posted 2012-06-20T01:01:08.990

Reputation: 81 905

8

Still another possibility:

Last[Convergents[0.1845095405274387]]

J. M.'s ennui

Posted 2012-06-20T01:01:08.990

Reputation: 115 520

1+1 for referencing a non-esoteric function I cannot recall using. – Mr.Wizard – 2012-06-22T02:02:38.673

I deal with continued fractions somewhat frequently, you see... – J. M.'s ennui – 2012-06-22T02:04:02.633

7

A couple of bits of code for your consideration:

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

Rationalize[0.1845095405274387, $MachineEpsilon]

Mr.Wizard

Posted 2012-06-20T01:01:08.990

Reputation: 259 163

@Mr.Wizard...I Thank you – emmett – 2012-06-20T02:08:55.970