natural package:ghc-bignum

Natural number Invariant: numbers <= 0xffffffffffffffff use the NS constructor
Add two naturals
Check Natural invariants
Check Natural invariants
Compare two Natural
Encode (# Natural mantissa, Int# exponent #) into a Double#
Encode (# Natural mantissa, Int# exponent #) into a Float# TODO: Not sure if it's worth to write Float optimized versions here
Equality test for Natural
Equality test for Natural
Read a Natural in base-256 representation from an Addr#. The size is given in bytes. The endianness is selected with the Bool# parameter: most significant byte first (big-endian) if 1# or least significant byte first (little-endian) if 0#. Null higher limbs are automatically trimed.
Read a Natural in base-256 representation from an Addr#. The size is given in bytes. The endianness is selected with the Bool# parameter: most significant byte first (big-endian) if 1# or least significant byte first (little-endian) if 0#. Null higher limbs are automatically trimed.
Create a Natural from a BigNat# (respect the invariants)
Read a Natural in base-256 representation from a ByteArray#. The size is given in bytes. The endianness is selected with the Bool# parameter: most significant byte first (big-endian) if 1# or least significant byte first (little-endian) if 0#. Null higher limbs are automatically trimed.
Create a Natural from a Word
Create a Natural from a Word#
Convert two Word# (most-significant first) into a Natural