Rational -package

type Rational = Ratio Integer
base Prelude, base Data.Ratio
Arbitrary-precision rational numbers, represented as a ratio of two Integer values. A rational number may be constructed using the % operator.
RationalL :: Rational -> Lit
template-haskell Language.Haskell.TH.Syntax, template-haskell Language.Haskell.TH
rational :: Rational -> Doc
pretty Text.PrettyPrint.HughesPJ, pretty Text.PrettyPrint, template-haskell Language.Haskell.TH.PprLib
rational :: Fractional a => Reader a
text Data.Text.Read
Read a rational number. This function accepts an optional leading sign character, followed by at least one decimal digit. The syntax similar to that accepted by the read function, with the exception that a trailing '.' or 'e' not followed by a number is not consumed. Examples (with behaviour identical to read): > rational "3" == Right (3.0, "") > rational "3.1" == Right (3.1, "") > rational "3e4" == Right (30000.0, "") > rational "3.1e4" == Right (31000.0, "") > rational ".3" == Left "input does not start with a digit" > rational "e3" == Left "input does not start with a digit" Examples of differences from read: > rational "3.foo" == Right (3.0, ".foo") > rational "3e" == Right (3.0, "e")
rational :: Fractional a => Reader a
text Data.Text.Lazy.Read
Read a rational number. This function accepts an optional leading sign character, followed by at least one decimal digit. The syntax similar to that accepted by the read function, with the exception that a trailing '.' or 'e' not followed by a number is not consumed. Examples: > rational "3" == Right (3.0, "") > rational "3.1" == Right (3.1, "") > rational "3e4" == Right (30000.0, "") > rational "3.1e4" == Right (31000.0, "") > rational ".3" == Left "input does not start with a digit" > rational "e3" == Left "input does not start with a digit" Examples of differences from read: > rational "3.foo" == Right (3.0, ".foo") > rational "3e" == Right (3.0, "e")
rationalL :: Rational -> Lit
template-haskell Language.Haskell.TH.Lib, template-haskell Language.Haskell.TH
fromRational :: Fractional a => Rational -> a
base Prelude
toRational :: Real a => a -> Rational
base Prelude
approxRational :: RealFrac a => a -> a -> Rational
base Data.Ratio
approxRational, 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'), and * denominator y <= denominator y'. Any real interval contains a unique simplest rational; in particular, note that 0/1 is the simplest rational of all.