DecimalToFraction

DecimalToFraction[s]

DecimalToFraction[s] writes s as the simplest fraction with the exact same value as s.

Example in out
A fraction with value 1.25. DecimalToFraction[ 1.25 ] 5/4
A fraction with value 0.333333. 333333/1000000
A fraction with value x, where x is defined as 3.14 in the script. DecimalToFraction[x] 157/50