planet-mitchell-0.1.0: Planet Mitchell

Num.Integral

Contents

Synopsis

Integral

class (Real a, Enum a) => Integral a where #

Integral numbers, supporting integer division.

Minimal complete definition

Methods

quot :: a -> a -> a infixl 7 #

integer division truncated toward zero

rem :: a -> a -> a infixl 7 #

integer remainder, satisfying

(x quot y)*y + (x rem y) == x

div :: a -> a -> a infixl 7 #

integer division truncated toward negative infinity

mod :: a -> a -> a infixl 7 #

integer modulus, satisfying

(x div y)*y + (x mod y) == x

quotRem :: a -> a -> (a, a) #

simultaneous quot and rem

divMod :: a -> a -> (a, a) #

simultaneous div and mod

toInteger :: a -> Integer #

conversion to Integer

Instances

even :: Integral a => a -> Bool #

odd :: Integral a => a -> Bool #

gcd :: Integral a => a -> a -> a #

gcd x y is the non-negative factor of both x and y of which every common factor of x and y is also a factor; for example gcd 4 2 = 2, gcd (-4) 6 = 2, gcd 0 4 = 4. gcd 0 0 = 0. (That is, the common divisor that is "greatest" in the divisibility preordering.)

Note: Since for signed fixed-width integer types, abs minBound < 0, the result may be negative if one of the arguments is minBound (and necessarily is if the other is 0 or minBound) for such types.

lcm :: Integral a => a -> a -> a #

lcm x y is the smallest positive integer that both x and y divide.

fromIntegral :: (Integral a, Num b) => a -> b #

general coercion from integral types

Show

showInt :: Integral a => a -> ShowS #

Show non-negative Integral numbers in base 10.

showIntAtBase :: (Integral a, Show a) => a -> (Int -> Char) -> a -> ShowS #

Shows a non-negative Integral number using the base specified by the first argument, and the character representation specified by the second.

showOct :: (Integral a, Show a) => a -> ShowS #

Show non-negative Integral numbers in base 8.

showHex :: (Integral a, Show a) => a -> ShowS #

Show non-negative Integral numbers in base 16.