hask.Data.Ratio – The Data.Ratio¶
-
hask.Data.Ratio.numerator(*args, **kwargs)¶ numerator :: Integral a => Ratio a -> aExtract the numerator of the ratio in reduced form: the numerator and denominator have no common factor and the denominator is positive.
-
hask.Data.Ratio.denominator(*args, **kwargs)¶ denominator :: Integral a => Ratio a -> aExtract the denominator of the ratio in reduced form: the numerator and denominator have no common factor and the denominator is positive.
-
hask.Data.Ratio.approxRational(*args, **kwargs)¶ approxRational :: RealFrac a => a -> a -> RationalapproxRational, applied to two real fractional numbers x and epsilon, returns the simplest rational number within epsilon of x. A rational number y is said to be simpler than another y’ if
abs(numerator(y)) <= abs(numerator(y_))anddenominator(y) <= denominator(y_).Any real interval contains a unique simplest rational; in particular, note that 0/1 is the simplest rational of all.