Copyright | (C) 2014 Herbert Valerio Riedel (C) 2011 Edward Kmett |
---|---|
License | see libraries/base/LICENSE |
Maintainer | libraries@haskell.org |
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
- 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
isValidNatural :: Natural -> Bool #
Conversions
naturalToWordMaybe :: Natural -> Maybe Word #
Checked subtraction
Modular arithmetic
powModNatural :: Natural -> Natural -> Natural -> Natural #
"
" computes base powModNatural
b e mb
raised to
exponent e
modulo m
.
Since: 4.8.0.0