planet-mitchell-0.1.0: Planet Mitchell

Num.Natural

Synopsis

Documentation

data Natural #

Type representing arbitrary-precision non-negative integers.

>>> 2^20 :: Natural
1267650600228229401496703205376


Operations whose result would be negative throw (Underflow :: ArithException),

>>> -1 :: Natural
*** Exception: arithmetic underflow


Since: base-4.8.0.0

Instances
 Since: base-4.8.0.0 Instance detailsDefined in GHC.Natural MethodsenumFrom :: Natural -> [Natural] #enumFromThen :: Natural -> Natural -> [Natural] #enumFromTo :: Natural -> Natural -> [Natural] #enumFromThenTo :: Natural -> Natural -> Natural -> [Natural] # Instance detailsDefined in GHC.Natural Methods(==) :: Natural -> Natural -> Bool #(/=) :: Natural -> Natural -> Bool # Since: base-4.8.0.0 Instance detailsDefined in GHC.Natural MethodsquotRem :: Natural -> Natural -> (Natural, Natural) #divMod :: Natural -> Natural -> (Natural, Natural) # Since: base-4.8.0.0 Instance detailsDefined in Data.Data Methodsgfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Natural -> c Natural #gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Natural #dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Natural) #dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Natural) #gmapT :: (forall b. Data b => b -> b) -> Natural -> Natural #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Natural -> r #gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Natural -> r #gmapQ :: (forall d. Data d => d -> u) -> Natural -> [u] #gmapQi :: Int -> (forall d. Data d => d -> u) -> Natural -> u #gmapM :: Monad m => (forall d. Data d => d -> m d) -> Natural -> m Natural #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Natural -> m Natural #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Natural -> m Natural # Since: base-4.8.0.0 Instance detailsDefined in GHC.Natural Methods Instance detailsDefined in GHC.Natural Methods(<) :: Natural -> Natural -> Bool #(<=) :: Natural -> Natural -> Bool #(>) :: Natural -> Natural -> Bool #(>=) :: Natural -> Natural -> Bool # Since: base-4.8.0.0 Instance detailsDefined in GHC.Natural Methods Since: base-4.8.0.0 Instance detailsDefined in GHC.Natural Methods Since: base-4.8.0.0 Instance detailsDefined in GHC.Natural MethodsshowList :: [Natural] -> ShowS # Since: base-4.8.0.0 Instance detailsDefined in GHC.Natural Methodsrange :: (Natural, Natural) -> [Natural] #index :: (Natural, Natural) -> Natural -> Int #unsafeIndex :: (Natural, Natural) -> Natural -> IntinRange :: (Natural, Natural) -> Natural -> Bool #rangeSize :: (Natural, Natural) -> Int #unsafeRangeSize :: (Natural, Natural) -> Int Instance detailsDefined in Language.Haskell.TH.Syntax Methodslift :: Natural -> Q Exp # Instance detailsDefined in Data.Hashable.Class Methodshash :: Natural -> Int # Instance detailsDefined in Data.Aeson.Types.ToJSON MethodstoJSONList :: [Natural] -> Value #toEncodingList :: [Natural] -> Encoding # Instance detailsDefined in Data.Aeson.Types.ToJSON Methods Instance detailsDefined in Data.Aeson.Types.FromJSON Methods Instance detailsDefined in Data.Aeson.Types.FromJSON Methods Since: base-4.8.0.0 Instance detailsDefined in Text.Printf Methods Since: base-4.8.0.0 Instance detailsDefined in GHC.Natural Methodsshift :: Natural -> Int -> Natural #rotate :: Natural -> Int -> Natural #bit :: Int -> Natural #setBit :: Natural -> Int -> Natural #testBit :: Natural -> Int -> Bool #shiftL :: Natural -> Int -> Natural #shiftR :: Natural -> Int -> Natural # Since: deepseq-1.4.0.0 Instance detailsDefined in Control.DeepSeq Methodsrnf :: Natural -> () # Instance detailsDefined in Data.Text.Prettyprint.Doc.Internal Methodspretty :: Natural -> Doc ann #prettyList :: [Natural] -> Doc ann # Since: serialise-0.2.0.0 Instance detailsDefined in Codec.Serialise.Class MethodsencodeList :: [Natural] -> Encoding # () :=> (Enum Natural) Instance detailsDefined in Data.Constraint Methodsins :: () :- Enum Natural # () :=> (Eq Natural) Instance detailsDefined in Data.Constraint Methodsins :: () :- Eq Natural # Instance detailsDefined in Data.Constraint Methods () :=> (Num Natural) Instance detailsDefined in Data.Constraint Methodsins :: () :- Num Natural # () :=> (Ord Natural) Instance detailsDefined in Data.Constraint Methodsins :: () :- Ord Natural # () :=> (Read Natural) Instance detailsDefined in Data.Constraint Methodsins :: () :- Read Natural # () :=> (Real Natural) Instance detailsDefined in Data.Constraint Methodsins :: () :- Real Natural # () :=> (Show Natural) Instance detailsDefined in Data.Constraint Methodsins :: () :- Show Natural # () :=> (Bits Natural) Instance detailsDefined in Data.Constraint Methodsins :: () :- Bits Natural #

Cacluate the integer logarithm for an arbitrary base. The base must be greater than 1, the second argument, the number whose logarithm is sought, must be positive, otherwise an error is thrown. If base == 2, the specialised version is called, which is more efficient than the general algorithm.

Satisfies:

base ^ integerLogBase base m <= m < base ^ (integerLogBase base m + 1)

for base > 1 and m > 0.

Calculate the natural logarithm of an Natural to base 2. The argument must be non-zero, otherwise an error is thrown.

Calculate the integer logarithm of an Integer to base 10. The argument must be not zero, otherwise an error is thrown.