Copyright | (C) 2014 Herbert Valerio Riedel (C) 2011 Edward Kmett |
---|---|
License | see libraries/base/LICENSE |
Maintainer | [email protected] |
Stability | internal |
Portability | non-portable (GHC Extensions) |
Safe Haskell | Unsafe |
Language | Haskell2010 |
The arbitrary-precision Natural
number type.
Note: This is an internal GHC module with an API subject to
change. It's recommended use the Numeric.Natural module to import
the Natural
type.
Since: 4.8.0.0
- data Natural
- isValidNatural :: Natural -> Bool
- naturalFromInteger :: Integer -> Natural
- wordToNatural :: Word -> Natural
- naturalToWordMaybe :: Natural -> Maybe Word
- minusNaturalMaybe :: Natural -> Natural -> Maybe Natural
- powModNatural :: Natural -> Natural -> Natural -> Natural
The Natural
number type
Warning: The internal implementation of Natural
(i.e. which constructors are available) depends on the
Integer
backend used!
Type representing arbitrary-precision non-negative integers.
Operations whose result would be negative
.throw
(Underflow
:: ArithException
)
Since: 4.8.0.0
NatS# GmpLimb# | in |
NatJ# !BigNat | in Invariant: |
Enum Natural # | Since: 4.8.0.0 |
Eq Natural # | |
Integral Natural # | Since: 4.8.0.0 |
Data Natural # | Since: 4.8.0.0 |
Num Natural # | Since: 4.8.0.0 |
Ord Natural # | |
Read Natural # | Since: 4.8.0.0 |
Real Natural # | Since: 4.8.0.0 |
Show Natural # | Since: 4.8.0.0 |
Ix Natural # | Since: 4.8.0.0 |
Bits Natural # | Since: 4.8.0.0 |
PrintfArg Natural # | Since: 4.8.0.0 |
isValidNatural :: Natural -> Bool Source #
Conversions
naturalFromInteger :: Integer -> Natural Source #
Since: 4.10.0.0
Checked subtraction
Modular arithmetic
powModNatural :: Natural -> Natural -> Natural -> Natural Source #
"
" computes base powModNatural
b e mb
raised to
exponent e
modulo m
.
Since: 4.8.0.0