I want to display some Rational
values in their decimal expansion. That is, instead of displaying 3 % 4
, I would rather display 0.75
. I'd like this function to be of type Int -> Rational -> String
. The first Int
is to specify the maximum number of decimal places, since Rational
expansions may be non-terminating.
Hoogle and the haddocks for Data.Ratio didn't help me. Where can I find this function?
Here is an arbitrary precision solution that doesn't use floats: