Haskell Core Libraries (base package)ParentContentsIndex
GHC.Real
Portability non-portable (GHC Extensions)
Stability internal
Maintainer cvs-ghc@haskell.org
Description
The types Ratio and Rational, and the classes Real, Fractional, Integral, and RealFrac.
Synopsis
data Ratio a = (:%) !a !a
type Rational = Ratio Integer
ratioPrec :: Int
ratioPrec1 :: Int
infinity :: Rational
notANumber :: Rational
(%) :: (Integral a) => a -> a -> Ratio a
numerator :: (Integral a) => Ratio a -> a
denominator :: (Integral a) => Ratio a -> a
reduce :: (Integral a) => a -> a -> Ratio a
class (Num a, Ord a) => Real a where
toRational :: a -> Rational
class (Real a, Enum a) => Integral a where
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
toInteger :: a -> Integer
class (Num a) => Fractional a where
(/) :: a -> a -> a
recip :: a -> a
fromRational :: Rational -> a
class (Real a, Fractional a) => RealFrac a where
properFraction :: (Integral b) => a -> (b, a)
truncate :: (Integral b) => a -> b
round :: (Integral b) => a -> b
ceiling :: (Integral b) => a -> b
floor :: (Integral b) => a -> b
numericEnumFrom :: (Fractional a) => a -> [a]
numericEnumFromThen :: (Fractional a) => a -> a -> [a]
numericEnumFromTo :: (Ord a, Fractional a) => a -> a -> [a]
numericEnumFromThenTo :: (Ord a, Fractional a) => a -> a -> a -> [a]
fromIntegral :: (Integral a, Num b) => a -> b
realToFrac :: (Real a, Fractional b) => a -> b
showSigned :: (Real a) => (a -> ShowS) -> Int -> a -> ShowS
even :: (Integral a) => a -> Bool
odd :: (Integral a) => a -> Bool
(^) :: (Num a, Integral b) => a -> b -> a
(^^) :: (Fractional a, Integral b) => a -> b -> a
gcd :: (Integral a) => a -> a -> a
lcm :: (Integral a) => a -> a -> a
integralEnumFrom :: (Integral a, Bounded a) => a -> [a]
integralEnumFromThen :: (Integral a, Bounded a) => a -> a -> [a]
integralEnumFromTo :: (Integral a) => a -> a -> [a]
integralEnumFromThenTo :: (Integral a) => a -> a -> a -> [a]
Documentation
data Ratio a
Constructors
(:%) !a !a
Instances
(Integral a, Read a) => Read (Ratio a)
(Integral a) => Ord (Ratio a)
(Integral a) => Num (Ratio a)
(Integral a) => Fractional (Ratio a)
(Integral a) => Real (Ratio a)
(Integral a) => RealFrac (Ratio a)
(Integral a) => Show (Ratio a)
(Integral a) => Enum (Ratio a)
type Rational = Ratio Integer
Arbitrary-precision rational numbers, represented as a ratio of two Integer values. A rational number may be constructed using the % operator.
ratioPrec :: Int
ratioPrec1 :: Int
infinity :: Rational
notANumber :: Rational
(%) :: (Integral a) => a -> a -> Ratio a
numerator :: (Integral a) => Ratio a -> a
denominator :: (Integral a) => Ratio a -> a
reduce :: (Integral a) => a -> a -> Ratio a
class (Num a, Ord a) => Real a where
Methods
toRational :: a -> Rational
Instances
Real Float
Real Double
Real Int8
Real Int16
Real Int32
Real Int64
Real Int
Real Integer
(Integral a) => Real (Ratio a)
Real Word
Real Word8
Real Word16
Real Word32
Real Word64
class (Real a, Enum a) => Integral a where
Methods
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
toInteger :: a -> Integer
Instances
Integral Int8
Integral Int16
Integral Int32
Integral Int64
Integral Int
Integral Integer
Integral Word
Integral Word8
Integral Word16
Integral Word32
Integral Word64
class (Num a) => Fractional a where
Methods
(/) :: a -> a -> a
recip :: a -> a
fromRational :: Rational -> a
Instances
(RealFloat a) => Fractional (Complex a)
Fractional Float
Fractional Double
(Integral a) => Fractional (Ratio a)
class (Real a, Fractional a) => RealFrac a where
Methods
properFraction :: (Integral b) => a -> (b, a)
truncate :: (Integral b) => a -> b
round :: (Integral b) => a -> b
ceiling :: (Integral b) => a -> b
floor :: (Integral b) => a -> b
Instances
RealFrac Float
RealFrac Double
(Integral a) => RealFrac (Ratio a)
numericEnumFrom :: (Fractional a) => a -> [a]
numericEnumFromThen :: (Fractional a) => a -> a -> [a]
numericEnumFromTo :: (Ord a, Fractional a) => a -> a -> [a]
numericEnumFromThenTo :: (Ord a, Fractional a) => a -> a -> a -> [a]
fromIntegral :: (Integral a, Num b) => a -> b
realToFrac :: (Real a, Fractional b) => a -> b
showSigned :: (Real a) => (a -> ShowS) -> Int -> a -> ShowS
even :: (Integral a) => a -> Bool
odd :: (Integral a) => a -> Bool
(^) :: (Num a, Integral b) => a -> b -> a
(^^) :: (Fractional a, Integral b) => a -> b -> a
gcd :: (Integral a) => a -> a -> a
lcm :: (Integral a) => a -> a -> a
integralEnumFrom :: (Integral a, Bounded a) => a -> [a]
integralEnumFromThen :: (Integral a, Bounded a) => a -> a -> [a]
integralEnumFromTo :: (Integral a) => a -> a -> [a]
integralEnumFromThenTo :: (Integral a) => a -> a -> a -> [a]
Produced by Haddock version 0.4