Friday, 9 August 2013

Turn a number $x$ into a fraction with a denominator with no more than $k$ digits

Turn a number $x$ into a fraction with a denominator with no more than $k$
digits

Is there a function for turning any number $x$ into a fraction with a
denominator that has a maximum of $k$ digits? (I'm sure there is, since
Excel has one built in, I just can't figure out what it is.)
For example, $f(0.1234) = $
$\frac{106}{859}$ where $k=3$;
$\frac{10}{81}$ where $k=2$;
$\frac{1}{8}$ where $k=1$.

No comments:

Post a Comment