Copyright | (c) Herbert Valerio Riedel 2014 |
---|---|
License | BSD3 |
Maintainer | [email protected] |
Stability | provisional |
Portability | non-portable (GHC Extensions) |
Safe Haskell | None |
Language | Haskell2010 |
The Integer
type.
This module exposes the portable Integer
API. See
GHC.Integer.GMP.Internals for the integer-gmp
-specific internal
representation of Integer
as well as optimized GMP-specific
operations.
- data Integer
- mkInteger :: Bool -> [Int] -> Integer
- smallInteger :: Int# -> Integer
- wordToInteger :: Word# -> Integer
- integerToWord :: Integer -> Word#
- integerToInt :: Integer -> Int#
- encodeFloatInteger :: Integer -> Int# -> Float#
- floatFromInteger :: Integer -> Float#
- encodeDoubleInteger :: Integer -> Int# -> Double#
- decodeDoubleInteger :: Double# -> (#Integer, Int##)
- doubleFromInteger :: Integer -> Double#
- plusInteger :: Integer -> Integer -> Integer
- minusInteger :: Integer -> Integer -> Integer
- timesInteger :: Integer -> Integer -> Integer
- negateInteger :: Integer -> Integer
- absInteger :: Integer -> Integer
- signumInteger :: Integer -> Integer
- divModInteger :: Integer -> Integer -> (#Integer, Integer#)
- divInteger :: Integer -> Integer -> Integer
- modInteger :: Integer -> Integer -> Integer
- quotRemInteger :: Integer -> Integer -> (#Integer, Integer#)
- quotInteger :: Integer -> Integer -> Integer
- remInteger :: Integer -> Integer -> Integer
- eqInteger :: Integer -> Integer -> Bool
- neqInteger :: Integer -> Integer -> Bool
- leInteger :: Integer -> Integer -> Bool
- gtInteger :: Integer -> Integer -> Bool
- ltInteger :: Integer -> Integer -> Bool
- geInteger :: Integer -> Integer -> Bool
- compareInteger :: Integer -> Integer -> Ordering
- eqInteger# :: Integer -> Integer -> Int#
- neqInteger# :: Integer -> Integer -> Int#
- leInteger# :: Integer -> Integer -> Int#
- gtInteger# :: Integer -> Integer -> Int#
- ltInteger# :: Integer -> Integer -> Int#
- geInteger# :: Integer -> Integer -> Int#
- andInteger :: Integer -> Integer -> Integer
- orInteger :: Integer -> Integer -> Integer
- xorInteger :: Integer -> Integer -> Integer
- complementInteger :: Integer -> Integer
- shiftLInteger :: Integer -> Int# -> Integer
- shiftRInteger :: Integer -> Int# -> Integer
- testBitInteger :: Integer -> Int# -> Bool
- hashInteger :: Integer -> Int#
Documentation
Construct Integer
s
smallInteger :: Int# -> Integer Source #
Should rather be called intToInteger
wordToInteger :: Word# -> Integer Source #
Conversion to other integral types
integerToWord :: Integer -> Word# Source #
Helpers for RealFloat
type-class operations
floatFromInteger :: Integer -> Float# Source #
doubleFromInteger :: Integer -> Double# Source #
Arithmetic operations
signumInteger :: Integer -> Integer Source #
Return -1
, 0
, and 1
depending on whether argument is
negative, zero, or positive, respectively
divModInteger :: Integer -> Integer -> (#Integer, Integer#) Source #
Simultaneous divInteger
and modInteger
.
Divisor must be non-zero otherwise the GHC runtime will terminate with a division-by-zero fault.
quotRemInteger :: Integer -> Integer -> (#Integer, Integer#) Source #
Simultaneous quotInteger
and remInteger
.
Divisor must be non-zero otherwise the GHC runtime will terminate with a division-by-zero fault.
Comparison predicates
Int#
-boolean valued versions of comparision predicates
These operations return 0#
and 1#
instead of False
and
True
respectively. See
PrimBool wiki-page
for more details
Bit-operations
complementInteger :: Integer -> Integer Source #
Bitwise NOT
operation
shiftLInteger :: Integer -> Int# -> Integer Source #
Shift-left operation
Even though the shift-amount is expressed as Int#
, the result is
undefined for negative shift-amounts.
shiftRInteger :: Integer -> Int# -> Integer Source #
Arithmetic shift-right operation
Even though the shift-amount is expressed as Int#
, the result is
undefined for negative shift-amounts.
Hashing
hashInteger :: Integer -> Int# Source #