Data.Ratio (original) (raw)

Description

Standard functions on rational numbers

Synopsis

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.