lue-bird / elm-morph / Integer

Arbitrary-precision whole number. See also Integer.Morph


type Integer
    = N0
    | Signed Signed

Arbitrary-precision integer, constructable from bits


type alias Signed =
RecordWithoutConstructorFunction { sign : Sign
, absolute : Natural.AtLeast1 
}

Arbitrary-precision signed Integer, constructable from a Sign and Natural.AtLeast1 bits

create

fromInt : Basics.Int -> Integer

Convert from an Int

fromNatural : Natural -> Integer

Convert from a Natural

alter

absolute : Integer -> Natural

Remove its Sign

negate : Integer -> Integer

Flip its Sign

transform

toInt : Integer -> Basics.Int

Convert to an Int

Keep in mind that this can overflow since Int is fixed in bit size while Integer is not.