bigInt.mli 1.23 KB
Newer Older
1 2 3 4 5 6 7 8


type t

val compare : t -> t -> int

(** constants *)
val zero : t
9
val one : t
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
val of_int : int -> t

(** basic operations *)
val succ : t -> t
val pred : t -> t
val add_int : int -> t -> t
val mul_int : int -> t -> t
val add : t -> t -> t
val sub : t -> t -> t
val mul : t -> t -> t
val minus : t -> t
val sign : t -> int

(** comparisons *)
val eq : t -> t -> bool
val lt : t -> t -> bool
val gt : t -> t -> bool
val le : t -> t -> bool
val ge : t -> t -> bool

(** Division and modulo operators with the convention 
that modulo is always non-negative.

It implies that division rounds down when divisor is positive, and
rounds up when divisor is negative.
*)
val euclidean_div_mod : t -> t -> t * t
val euclidean_div : t -> t -> t 
val euclidean_mod : t -> t -> t 

(** "computer" division, i.e division rounds towards zero, and thus [mod
    x y] has the same sign as x
*)
val computer_div_mod : t -> t -> t * t
val computer_div : t -> t -> t 
val computer_mod : t -> t -> t 

47
(** min, max, abs *)
48 49
val min : t -> t -> t
val max : t -> t -> t
50
val abs : t -> t
51 52 53 54

(** power of small integers. Second arg must be non-negative *)
val pow_int_pos : int -> int -> t

55
(** conversions *)
56 57
val of_string : string -> t
val to_string : t -> string
58
val to_int : t -> int