GHC.Natural
Compatibility module for pre ghc-bignum code.
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 | |
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