Module BigInt

module BigInt: sig .. end

Wrapper for big nums, implemented either with OCaml's Nums or ZArith


type t 
val compare : t -> t -> int
val zero : t

constants

val one : t
val of_int : int -> t
val succ : t -> t

basic operations

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
val eq : t -> t -> bool

comparisons

val lt : t -> t -> bool
val gt : t -> t -> bool
val le : t -> t -> bool
val ge : t -> t -> bool
val euclidean_div_mod : t -> t -> t * t

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 : t -> t -> t
val euclidean_mod : t -> t -> t
val computer_div_mod : t -> 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 : t -> t -> t
val computer_mod : t -> t -> t
val min : t -> t -> t

min, max, abs

val max : t -> t -> t
val abs : t -> t
val num_digits : t -> int

number of digits

val pow_int_pos : int -> int -> t

power of small integers. Second arg must be non-negative

val pow_int_pos_bigint : int -> t -> t
val of_string : string -> t

conversions

val to_string : t -> string
val to_int : t -> int