BatNumber

`sig
exception Overflow
exception NaN
type 'a numeric = {
zero : 'a;
one : 'a;
neg : 'a -> 'a;
succ : 'a -> 'a;
pred : 'a -> 'a;
abs : 'a -> 'a;
add : 'a -> 'a -> 'a;
sub : 'a -> 'a -> 'a;
mul : 'a -> 'a -> 'a;
div : 'a -> 'a -> 'a;
modulo : 'a -> 'a -> 'a;
pow : 'a -> 'a -> 'a;
compare : 'a -> 'a -> int;
of_int : int -> 'a;
to_int : 'a -> int;
of_string : string -> 'a;
to_string : 'a -> string;
of_float : float -> 'a;
to_float : 'a -> float;
}
module type Infix =
sig
type bat__infix_t
val ( + ) :
BatNumber.Infix.bat__infix_t ->
BatNumber.Infix.bat__infix_t -> BatNumber.Infix.bat__infix_t
val ( - ) :
BatNumber.Infix.bat__infix_t ->
BatNumber.Infix.bat__infix_t -> BatNumber.Infix.bat__infix_t
val ( * ) :
BatNumber.Infix.bat__infix_t ->
BatNumber.Infix.bat__infix_t -> BatNumber.Infix.bat__infix_t
val ( / ) :
BatNumber.Infix.bat__infix_t ->
BatNumber.Infix.bat__infix_t -> BatNumber.Infix.bat__infix_t
val ( ** ) :
BatNumber.Infix.bat__infix_t ->
BatNumber.Infix.bat__infix_t -> BatNumber.Infix.bat__infix_t
val ( -- ) :
BatNumber.Infix.bat__infix_t ->
BatNumber.Infix.bat__infix_t ->
BatNumber.Infix.bat__infix_t BatEnum.t
val ( --- ) :
BatNumber.Infix.bat__infix_t ->
BatNumber.Infix.bat__infix_t ->
BatNumber.Infix.bat__infix_t BatEnum.t
end
module type Compare =
sig
type bat__compare_t
val ( <> ) :
BatNumber.Compare.bat__compare_t ->
BatNumber.Compare.bat__compare_t -> bool
val ( >= ) :
BatNumber.Compare.bat__compare_t ->
BatNumber.Compare.bat__compare_t -> bool
val ( <= ) :
BatNumber.Compare.bat__compare_t ->
BatNumber.Compare.bat__compare_t -> bool
val ( > ) :
BatNumber.Compare.bat__compare_t ->
BatNumber.Compare.bat__compare_t -> bool
val ( < ) :
BatNumber.Compare.bat__compare_t ->
BatNumber.Compare.bat__compare_t -> bool
val ( = ) :
BatNumber.Compare.bat__compare_t ->
BatNumber.Compare.bat__compare_t -> bool
end
module type Numeric =
sig
type t
val zero : BatNumber.Numeric.t
val one : BatNumber.Numeric.t
val neg : BatNumber.Numeric.t -> BatNumber.Numeric.t
val abs : BatNumber.Numeric.t -> BatNumber.Numeric.t
val add :
BatNumber.Numeric.t -> BatNumber.Numeric.t -> BatNumber.Numeric.t
val sub :
BatNumber.Numeric.t -> BatNumber.Numeric.t -> BatNumber.Numeric.t
val mul :
BatNumber.Numeric.t -> BatNumber.Numeric.t -> BatNumber.Numeric.t
val div :
BatNumber.Numeric.t -> BatNumber.Numeric.t -> BatNumber.Numeric.t
val modulo :
BatNumber.Numeric.t -> BatNumber.Numeric.t -> BatNumber.Numeric.t
val pow :
BatNumber.Numeric.t -> BatNumber.Numeric.t -> BatNumber.Numeric.t
val compare : BatNumber.Numeric.t -> BatNumber.Numeric.t -> int
val of_int : int -> BatNumber.Numeric.t
val to_int : BatNumber.Numeric.t -> int
val of_float : float -> BatNumber.Numeric.t
val to_float : BatNumber.Numeric.t -> float
val of_string : string -> BatNumber.Numeric.t
val to_string : BatNumber.Numeric.t -> string
val operations : BatNumber.Numeric.t BatNumber.numeric
type discrete = BatNumber.Numeric.t
val succ : BatNumber.Numeric.t -> BatNumber.Numeric.t
val pred : BatNumber.Numeric.t -> BatNumber.Numeric.t
type bat__infix_t = t
val ( + ) : bat__infix_t -> bat__infix_t -> bat__infix_t
val ( - ) : bat__infix_t -> bat__infix_t -> bat__infix_t
val ( * ) : bat__infix_t -> bat__infix_t -> bat__infix_t
val ( / ) : bat__infix_t -> bat__infix_t -> bat__infix_t
val ( ** ) : bat__infix_t -> bat__infix_t -> bat__infix_t
val ( -- ) : bat__infix_t -> bat__infix_t -> bat__infix_t BatEnum.t
val ( --- ) : bat__infix_t -> bat__infix_t -> bat__infix_t BatEnum.t
type bat__compare_t = t
val ( <> ) : bat__compare_t -> bat__compare_t -> bool
val ( >= ) : bat__compare_t -> bat__compare_t -> bool
val ( <= ) : bat__compare_t -> bat__compare_t -> bool
val ( > ) : bat__compare_t -> bat__compare_t -> bool
val ( < ) : bat__compare_t -> bat__compare_t -> bool
val ( = ) : bat__compare_t -> bat__compare_t -> bool
end
module type Bounded =
sig
type bounded
val min_num : BatNumber.Bounded.bounded
val max_num : BatNumber.Bounded.bounded
end
module type Discrete =
sig
type discrete
val to_int : BatNumber.Discrete.discrete -> int
val succ : BatNumber.Discrete.discrete -> BatNumber.Discrete.discrete
val pred : BatNumber.Discrete.discrete -> BatNumber.Discrete.discrete
val ( -- ) :
BatNumber.Discrete.discrete ->
BatNumber.Discrete.discrete -> BatNumber.Discrete.discrete BatEnum.t
val ( --- ) :
BatNumber.Discrete.discrete ->
BatNumber.Discrete.discrete -> BatNumber.Discrete.discrete BatEnum.t
end
module type NUMERIC_BASE =
sig
type t
val zero : BatNumber.NUMERIC_BASE.t
val one : BatNumber.NUMERIC_BASE.t
val neg : BatNumber.NUMERIC_BASE.t -> BatNumber.NUMERIC_BASE.t
val succ : BatNumber.NUMERIC_BASE.t -> BatNumber.NUMERIC_BASE.t
val pred : BatNumber.NUMERIC_BASE.t -> BatNumber.NUMERIC_BASE.t
val abs : BatNumber.NUMERIC_BASE.t -> BatNumber.NUMERIC_BASE.t
val add :
BatNumber.NUMERIC_BASE.t ->
BatNumber.NUMERIC_BASE.t -> BatNumber.NUMERIC_BASE.t
val sub :
BatNumber.NUMERIC_BASE.t ->
BatNumber.NUMERIC_BASE.t -> BatNumber.NUMERIC_BASE.t
val mul :
BatNumber.NUMERIC_BASE.t ->
BatNumber.NUMERIC_BASE.t -> BatNumber.NUMERIC_BASE.t
val div :
BatNumber.NUMERIC_BASE.t ->
BatNumber.NUMERIC_BASE.t -> BatNumber.NUMERIC_BASE.t
val modulo :
BatNumber.NUMERIC_BASE.t ->
BatNumber.NUMERIC_BASE.t -> BatNumber.NUMERIC_BASE.t
val pow :
BatNumber.NUMERIC_BASE.t ->
BatNumber.NUMERIC_BASE.t -> BatNumber.NUMERIC_BASE.t
val compare :
BatNumber.NUMERIC_BASE.t -> BatNumber.NUMERIC_BASE.t -> int
val of_int : int -> BatNumber.NUMERIC_BASE.t
val to_int : BatNumber.NUMERIC_BASE.t -> int
val of_string : string -> BatNumber.NUMERIC_BASE.t
val to_string : BatNumber.NUMERIC_BASE.t -> string
val of_float : float -> BatNumber.NUMERIC_BASE.t
val to_float : BatNumber.NUMERIC_BASE.t -> float
end
module MakeInfix :
functor (Base : NUMERIC_BASE) ->
sig
type bat__infix_t = Base.t
val ( + ) : bat__infix_t -> bat__infix_t -> bat__infix_t
val ( - ) : bat__infix_t -> bat__infix_t -> bat__infix_t
val ( * ) : bat__infix_t -> bat__infix_t -> bat__infix_t
val ( / ) : bat__infix_t -> bat__infix_t -> bat__infix_t
val ( ** ) : bat__infix_t -> bat__infix_t -> bat__infix_t
val ( -- ) : bat__infix_t -> bat__infix_t -> bat__infix_t BatEnum.t
val ( --- ) : bat__infix_t -> bat__infix_t -> bat__infix_t BatEnum.t
end
module MakeCompare :
functor (Base : NUMERIC_BASE) ->
sig
type bat__compare_t = Base.t
val ( <> ) : bat__compare_t -> bat__compare_t -> bool
val ( >= ) : bat__compare_t -> bat__compare_t -> bool
val ( <= ) : bat__compare_t -> bat__compare_t -> bool
val ( > ) : bat__compare_t -> bat__compare_t -> bool
val ( < ) : bat__compare_t -> bat__compare_t -> bool
val ( = ) : bat__compare_t -> bat__compare_t -> bool
end
module MakeNumeric :
functor (Base : NUMERIC_BASE) ->
sig
type t = Base.t
val zero : t
val one : t
val neg : t -> t
val abs : t -> t
val add : t -> t -> t
val sub : t -> t -> t
val mul : t -> t -> t
val div : t -> t -> t
val modulo : t -> t -> t
val pow : t -> t -> t
val compare : t -> t -> int
val of_int : int -> t
val to_int : t -> int
val of_float : float -> t
val to_float : t -> float
val of_string : string -> t
val to_string : t -> string
val operations : t numeric
type discrete = t
val succ : t -> t
val pred : t -> t
type bat__infix_t = t
val ( + ) : bat__infix_t -> bat__infix_t -> bat__infix_t
val ( - ) : bat__infix_t -> bat__infix_t -> bat__infix_t
val ( * ) : bat__infix_t -> bat__infix_t -> bat__infix_t
val ( / ) : bat__infix_t -> bat__infix_t -> bat__infix_t
val ( ** ) : bat__infix_t -> bat__infix_t -> bat__infix_t
val ( -- ) : bat__infix_t -> bat__infix_t -> bat__infix_t BatEnum.t
val ( --- ) : bat__infix_t -> bat__infix_t -> bat__infix_t BatEnum.t
type bat__compare_t = t
val ( <> ) : bat__compare_t -> bat__compare_t -> bool
val ( >= ) : bat__compare_t -> bat__compare_t -> bool
val ( <= ) : bat__compare_t -> bat__compare_t -> bool
val ( > ) : bat__compare_t -> bat__compare_t -> bool
val ( < ) : bat__compare_t -> bat__compare_t -> bool
val ( = ) : bat__compare_t -> bat__compare_t -> bool
end
val generic_pow :
zero:'a ->
one:'a ->
div_two:('a -> 'a) ->
mod_two:('a -> 'a) -> mul:('a -> 'a -> 'a) -> 'a -> 'a -> 'a
end`