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 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 ( + ) :
BatNumber.Numeric.t -> BatNumber.Numeric.t -> BatNumber.Numeric.t
val ( - ) :
BatNumber.Numeric.t -> BatNumber.Numeric.t -> BatNumber.Numeric.t
val ( * ) :
BatNumber.Numeric.t -> BatNumber.Numeric.t -> BatNumber.Numeric.t
val ( / ) :
BatNumber.Numeric.t -> BatNumber.Numeric.t -> BatNumber.Numeric.t
val ( ** ) :
BatNumber.Numeric.t -> BatNumber.Numeric.t -> BatNumber.Numeric.t
val ( <> ) : BatNumber.Numeric.t -> BatNumber.Numeric.t -> bool
val ( >= ) : BatNumber.Numeric.t -> BatNumber.Numeric.t -> bool
val ( <= ) : BatNumber.Numeric.t -> BatNumber.Numeric.t -> bool
val ( > ) : BatNumber.Numeric.t -> BatNumber.Numeric.t -> bool
val ( < ) : BatNumber.Numeric.t -> BatNumber.Numeric.t -> bool
val ( = ) : BatNumber.Numeric.t -> BatNumber.Numeric.t -> bool
val operations : BatNumber.Numeric.t BatNumber.numeric
end
module type Bounded =
sig
type t
val min_num : BatNumber.Bounded.t
val max_num : BatNumber.Bounded.t
end
module type Discrete =
sig
type t
val to_int : BatNumber.Discrete.t -> int
val succ : BatNumber.Discrete.t -> BatNumber.Discrete.t
val pred : BatNumber.Discrete.t -> BatNumber.Discrete.t
val ( -- ) :
BatNumber.Discrete.t ->
BatNumber.Discrete.t -> BatNumber.Discrete.t BatEnum.t
val ( --- ) :
BatNumber.Discrete.t ->
BatNumber.Discrete.t -> BatNumber.Discrete.t 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 MakeNumeric :
functor (Base : NUMERIC_BASE) ->
sig
val operations : Base.t BatNumber.numeric
val ( + ) : Base.t -> Base.t -> Base.t
val ( - ) : Base.t -> Base.t -> Base.t
val ( * ) : Base.t -> Base.t -> Base.t
val ( / ) : Base.t -> Base.t -> Base.t
val ( ** ) : Base.t -> Base.t -> Base.t
val ( <> ) : Base.t -> Base.t -> bool
val ( >= ) : Base.t -> Base.t -> bool
val ( <= ) : Base.t -> Base.t -> bool
val ( > ) : Base.t -> Base.t -> bool
val ( < ) : Base.t -> Base.t -> bool
val ( = ) : Base.t -> Base.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