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
class (Num a) => Fractional a where
fromRational :: Rational -> a
recip :: a -> a
(/) :: a -> a -> a
class (Real a, Enum a) => Integral a where
toInteger :: a -> Integer
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
data Ratio a = (:%) !a !a
type Rational = Ratio Integer
class (Num a, Ord a) => Real a where
toRational :: a -> Rational
class (Real a, Fractional a) => RealFrac a where
ceiling :: (Integral b) => a -> b
floor :: (Integral b) => a -> b
truncate :: (Integral b) => a -> b
round :: (Integral b) => a -> b
properFraction :: (Integral b) => a -> (b, a)
class (Real a, Fractional a) => RealFrac a where
ceiling :: (Integral b) => a -> b
floor :: (Integral b) => a -> b
truncate :: (Integral b) => a -> b
round :: (Integral b) => a -> b
properFraction :: (Integral b) => a -> (b, a)
denominator :: (Integral a) => Ratio a -> a
class (Real a, Enum a) => Integral a where
toInteger :: a -> Integer
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
class (Real a, Enum a) => Integral a where
toInteger :: a -> Integer
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
even :: (Integral a) => a -> Bool
class (Real a, Fractional a) => RealFrac a where
ceiling :: (Integral b) => a -> b
floor :: (Integral b) => a -> b
truncate :: (Integral b) => a -> b
round :: (Integral b) => a -> b
properFraction :: (Integral b) => a -> (b, a)
fromIntegral :: (Integral a, Num b) => a -> b
class (Num a) => Fractional a where
fromRational :: Rational -> a
recip :: a -> a
(/) :: a -> a -> a
gcd :: (Integral a) => a -> a -> a
infinity :: Rational
integralEnumFrom :: (Integral a, Bounded a) => a -> [a]
integralEnumFromThen :: (Integral a, Bounded a) => a -> a -> [a]
integralEnumFromThenTo :: (Integral a) => a -> a -> a -> [a]
integralEnumFromTo :: (Integral a) => a -> a -> [a]
lcm :: (Integral a) => a -> a -> a
class (Real a, Enum a) => Integral a where
toInteger :: a -> Integer
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
notANumber :: Rational
numerator :: (Integral a) => Ratio a -> a
numericEnumFrom :: (Fractional a) => a -> [a]
numericEnumFromThen :: (Fractional a) => a -> a -> [a]
numericEnumFromThenTo :: (Ord a, Fractional a) => a -> a -> a -> [a]
numericEnumFromTo :: (Ord a, Fractional a) => a -> a -> [a]
odd :: (Integral a) => a -> Bool
class (Real a, Fractional a) => RealFrac a where
ceiling :: (Integral b) => a -> b
floor :: (Integral b) => a -> b
truncate :: (Integral b) => a -> b
round :: (Integral b) => a -> b
properFraction :: (Integral b) => a -> (b, a)
class (Real a, Enum a) => Integral a where
toInteger :: a -> Integer
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
class (Real a, Enum a) => Integral a where
toInteger :: a -> Integer
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
ratio_prec :: Int
realToFrac :: (Real a, Fractional b) => a -> b
class (Num a) => Fractional a where
fromRational :: Rational -> a
recip :: a -> a
(/) :: a -> a -> a
reduce :: (Integral a) => a -> a -> Ratio a
class (Real a, Enum a) => Integral a where
toInteger :: a -> Integer
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
class (Real a, Fractional a) => RealFrac a where
ceiling :: (Integral b) => a -> b
floor :: (Integral b) => a -> b
truncate :: (Integral b) => a -> b
round :: (Integral b) => a -> b
properFraction :: (Integral b) => a -> (b, a)
showSigned :: (Real a) => (a -> ShowS) -> Int -> a -> ShowS
class (Real a, Enum a) => Integral a where
toInteger :: a -> Integer
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
class (Num a, Ord a) => Real a where
toRational :: a -> Rational
class (Real a, Fractional a) => RealFrac a where
ceiling :: (Integral b) => a -> b
floor :: (Integral b) => a -> b
truncate :: (Integral b) => a -> b
round :: (Integral b) => a -> b
properFraction :: (Integral b) => a -> (b, a)
(%) :: (Integral a) => a -> a -> Ratio a
class (Num a) => Fractional a where
fromRational :: Rational -> a
recip :: a -> a
(/) :: a -> a -> a
data Ratio a = (:%) !a !a
(^) :: (Num a, Integral b) => a -> b -> a
(^^) :: (Fractional a, Integral b) => a -> b -> a
Documentation
class (Num a) => Fractional a where
Methods
fromRational :: Rational -> a
recip :: a -> a
(/) :: a -> a -> a
Instances
(RealFloat a) => Fractional (Complex a)
Fractional Float
Fractional Double
(Integral a) => Fractional (Ratio a)
class (Real a, Enum a) => Integral a where
Methods
toInteger :: a -> Integer
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
Instances
Integral Int8
Integral Int16
Integral Int32
Integral Int64
Integral Int
Integral Integer
Integral Word
Integral Word8
Integral Word16
Integral Word32
Integral Word64
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.
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, Fractional a) => RealFrac a where
Methods
ceiling :: (Integral b) => a -> b
floor :: (Integral b) => a -> b
truncate :: (Integral b) => a -> b
round :: (Integral b) => a -> b
properFraction :: (Integral b) => a -> (b, a)
Instances
RealFrac Float
RealFrac Double
(Integral a) => RealFrac (Ratio a)
class (Real a, Fractional a) => RealFrac a where
Methods
ceiling :: (Integral b) => a -> b
floor :: (Integral b) => a -> b
truncate :: (Integral b) => a -> b
round :: (Integral b) => a -> b
properFraction :: (Integral b) => a -> (b, a)
denominator :: (Integral a) => Ratio a -> a
class (Real a, Enum a) => Integral a where
Methods
toInteger :: a -> Integer
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
class (Real a, Enum a) => Integral a where
Methods
toInteger :: a -> Integer
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
even :: (Integral a) => a -> Bool
class (Real a, Fractional a) => RealFrac a where
Methods
ceiling :: (Integral b) => a -> b
floor :: (Integral b) => a -> b
truncate :: (Integral b) => a -> b
round :: (Integral b) => a -> b
properFraction :: (Integral b) => a -> (b, a)
fromIntegral :: (Integral a, Num b) => a -> b
class (Num a) => Fractional a where
Methods
fromRational :: Rational -> a
recip :: a -> a
(/) :: a -> a -> a
gcd :: (Integral a) => a -> a -> a
infinity :: Rational
integralEnumFrom :: (Integral a, Bounded a) => a -> [a]
integralEnumFromThen :: (Integral a, Bounded a) => a -> a -> [a]
integralEnumFromThenTo :: (Integral a) => a -> a -> a -> [a]
integralEnumFromTo :: (Integral a) => a -> a -> [a]
lcm :: (Integral a) => a -> a -> a
class (Real a, Enum a) => Integral a where
Methods
toInteger :: a -> Integer
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
notANumber :: Rational
numerator :: (Integral a) => Ratio a -> a
numericEnumFrom :: (Fractional a) => a -> [a]
numericEnumFromThen :: (Fractional a) => a -> a -> [a]
numericEnumFromThenTo :: (Ord a, Fractional a) => a -> a -> a -> [a]
numericEnumFromTo :: (Ord a, Fractional a) => a -> a -> [a]
odd :: (Integral a) => a -> Bool
class (Real a, Fractional a) => RealFrac a where
Methods
ceiling :: (Integral b) => a -> b
floor :: (Integral b) => a -> b
truncate :: (Integral b) => a -> b
round :: (Integral b) => a -> b
properFraction :: (Integral b) => a -> (b, a)
class (Real a, Enum a) => Integral a where
Methods
toInteger :: a -> Integer
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
class (Real a, Enum a) => Integral a where
Methods
toInteger :: a -> Integer
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
ratio_prec :: Int
realToFrac :: (Real a, Fractional b) => a -> b
class (Num a) => Fractional a where
Methods
fromRational :: Rational -> a
recip :: a -> a
(/) :: a -> a -> a
reduce :: (Integral a) => a -> a -> Ratio a
class (Real a, Enum a) => Integral a where
Methods
toInteger :: a -> Integer
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
class (Real a, Fractional a) => RealFrac a where
Methods
ceiling :: (Integral b) => a -> b
floor :: (Integral b) => a -> b
truncate :: (Integral b) => a -> b
round :: (Integral b) => a -> b
properFraction :: (Integral b) => a -> (b, a)
showSigned :: (Real a) => (a -> ShowS) -> Int -> a -> ShowS
class (Real a, Enum a) => Integral a where
Methods
toInteger :: a -> Integer
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
class (Num a, Ord a) => Real a where
Methods
toRational :: a -> Rational
class (Real a, Fractional a) => RealFrac a where
Methods
ceiling :: (Integral b) => a -> b
floor :: (Integral b) => a -> b
truncate :: (Integral b) => a -> b
round :: (Integral b) => a -> b
properFraction :: (Integral b) => a -> (b, a)
(%) :: (Integral a) => a -> a -> Ratio a
class (Num a) => Fractional a where
Methods
fromRational :: Rational -> a
recip :: a -> a
(/) :: a -> a -> a
data Ratio a
Constructors
(:%) !a !a
(^) :: (Num a, Integral b) => a -> b -> a
(^^) :: (Fractional a, Integral b) => a -> b -> a
Produced by Haddock version 0.3