Data.Ratio (original) (raw)
Description
Standard functions on rational numbers
Synopsis
- data Ratio a
- type Rational = Ratio Integer
- (%) :: Integral a => a -> a -> Ratio a
- numerator :: Integral a => Ratio a -> a
- denominator :: Integral a => Ratio a -> a
- approxRational :: RealFrac a => a -> a -> Rational
Documentation
type Rational = Ratio IntegerSource
Arbitrary-precision rational numbers, represented as a ratio of two [Integer](Prelude.html#t:Integer)
values. A rational number may be constructed using the [%](Data-Ratio.html#v:-37-)
operator.
numerator :: Integral a => Ratio a -> aSource
Extract the numerator of the ratio in reduced form: the numerator and denominator have no common factor and the denominator is positive.
denominator :: Integral a => Ratio a -> aSource
Extract the denominator of the ratio in reduced form: the numerator and denominator have no common factor and the denominator is positive.