Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
Compatibility module for pre ghc-bignum code.
Synopsis
- data Natural where
- data BigNat = BN# {}
- mkNatural :: [Word] -> Natural
- isValidNatural :: Natural -> Bool
- plusNatural :: Natural -> Natural -> Natural
- minusNatural :: Natural -> Natural -> Natural
- minusNaturalMaybe :: Natural -> Natural -> Maybe Natural
- timesNatural :: Natural -> Natural -> Natural
- negateNatural :: Natural -> Natural
- signumNatural :: Natural -> Natural
- quotRemNatural :: Natural -> Natural -> (Natural, Natural)
- quotNatural :: Natural -> Natural -> Natural
- remNatural :: Natural -> Natural -> Natural
- gcdNatural :: Natural -> Natural -> Natural
- lcmNatural :: Natural -> Natural -> Natural
- andNatural :: Natural -> Natural -> Natural
- orNatural :: Natural -> Natural -> Natural
- xorNatural :: Natural -> Natural -> Natural
- bitNatural :: Int# -> Natural
- testBitNatural :: Natural -> Int -> Bool
- popCountNatural :: Natural -> Int
- shiftLNatural :: Natural -> Int -> Natural
- shiftRNatural :: Natural -> Int -> Natural
- naturalToInteger :: Natural -> Integer
- naturalToWord :: Natural -> Word
- naturalToWordMaybe :: Natural -> Maybe Word
- wordToNatural :: Word -> Natural
- wordToNatural# :: Word -> Natural
- naturalFromInteger :: Integer -> Natural
- powModNatural :: Natural -> Natural -> Natural -> Natural
Documentation
Natural number
Invariant: numbers <= 0xffffffffffffffff use the NS
constructor
Instances
A lifted BigNat
Represented as an array of limbs (Word#) stored in little-endian order (Word# themselves use machine order).
Invariant (canonical representation): higher Word# is non-zero.
As a consequence, zero is represented with a WordArray# whose size is 0.
Instances
Eq BigNat | |
Ord BigNat | |
Defined in GHC.Num.BigNat |
isValidNatural :: Natural -> Bool Source #
Arithmetic
negateNatural :: Natural -> Natural Source #
signumNatural :: Natural -> Natural Source #
Bits
bitNatural :: Int# -> Natural Source #
popCountNatural :: Natural -> Int Source #
Conversions
naturalToInteger :: Natural -> Integer Source #
Since: base-4.12.0.0
naturalToWord :: Natural -> Word Source #
wordToNatural# :: Word -> Natural Source #
naturalFromInteger :: Integer -> Natural Source #
Since: base-4.10.0.0
Modular arithmetic
powModNatural :: Natural -> Natural -> Natural -> Natural Source #
"
" computes base powModNatural
b e mb
raised to
exponent e
modulo m
.
Since: base-4.8.0.0