sig
type t
exception Overflow
val zero : Z.t
val one : Z.t
val minus_one : Z.t
external of_int : int -> Z.t = "%identity"
external of_int32 : int32 -> Z.t = "ml_z_of_int32"
external of_int64 : int64 -> Z.t = "ml_z_of_int64"
external of_nativeint : nativeint -> Z.t = "ml_z_of_nativeint"
external of_float : float -> Z.t = "ml_z_of_float"
val of_string : string -> Z.t
val of_substring : string -> pos:int -> len:int -> Z.t
val of_string_base : int -> string -> Z.t
external of_substring_base : int -> string -> pos:int -> len:int -> Z.t
= "ml_z_of_substring_base"
val succ : Z.t -> Z.t
val pred : Z.t -> Z.t
val abs : Z.t -> Z.t
val neg : Z.t -> Z.t
val add : Z.t -> Z.t -> Z.t
val sub : Z.t -> Z.t -> Z.t
val mul : Z.t -> Z.t -> Z.t
val div : Z.t -> Z.t -> Z.t
val rem : Z.t -> Z.t -> Z.t
external div_rem : Z.t -> Z.t -> Z.t * Z.t = "ml_z_div_rem"
external cdiv : Z.t -> Z.t -> Z.t = "ml_z_cdiv"
external fdiv : Z.t -> Z.t -> Z.t = "ml_z_fdiv"
val ediv_rem : Z.t -> Z.t -> Z.t * Z.t
val ediv : Z.t -> Z.t -> Z.t
val erem : Z.t -> Z.t -> Z.t
val divexact : Z.t -> Z.t -> Z.t
external divisible : Z.t -> Z.t -> bool = "ml_z_divisible"
external congruent : Z.t -> Z.t -> Z.t -> bool = "ml_z_congruent"
val logand : Z.t -> Z.t -> Z.t
val logor : Z.t -> Z.t -> Z.t
val logxor : Z.t -> Z.t -> Z.t
val lognot : Z.t -> Z.t
val shift_left : Z.t -> int -> Z.t
val shift_right : Z.t -> int -> Z.t
val shift_right_trunc : Z.t -> int -> Z.t
external numbits : Z.t -> int = "ml_z_numbits" [@@noalloc]
external trailing_zeros : Z.t -> int = "ml_z_trailing_zeros" [@@noalloc]
val testbit : Z.t -> int -> bool
external popcount : Z.t -> int = "ml_z_popcount"
external hamdist : Z.t -> Z.t -> int = "ml_z_hamdist"
val to_int : Z.t -> int
external to_int32 : Z.t -> int32 = "ml_z_to_int32"
external to_int64 : Z.t -> int64 = "ml_z_to_int64"
external to_nativeint : Z.t -> nativeint = "ml_z_to_nativeint"
val to_float : Z.t -> float
val to_string : Z.t -> string
external format : string -> Z.t -> string = "ml_z_format"
external fits_int : Z.t -> bool = "ml_z_fits_int" [@@noalloc]
external fits_int32 : Z.t -> bool = "ml_z_fits_int32" [@@noalloc]
external fits_int64 : Z.t -> bool = "ml_z_fits_int64" [@@noalloc]
external fits_nativeint : Z.t -> bool = "ml_z_fits_nativeint" [@@noalloc]
val print : Z.t -> unit
val output : Stdlib.out_channel -> Z.t -> unit
val sprint : unit -> Z.t -> string
val bprint : Stdlib.Buffer.t -> Z.t -> unit
val pp_print : Stdlib.Format.formatter -> Z.t -> unit
external compare : Z.t -> Z.t -> int = "ml_z_compare" [@@noalloc]
external equal : Z.t -> Z.t -> bool = "ml_z_equal" [@@noalloc]
val leq : Z.t -> Z.t -> bool
val geq : Z.t -> Z.t -> bool
val lt : Z.t -> Z.t -> bool
val gt : Z.t -> Z.t -> bool
external sign : Z.t -> int = "ml_z_sign" [@@noalloc]
val min : Z.t -> Z.t -> Z.t
val max : Z.t -> Z.t -> Z.t
val is_even : Z.t -> bool
val is_odd : Z.t -> bool
external hash : Z.t -> int = "ml_z_hash" [@@noalloc]
external gcd : Z.t -> Z.t -> Z.t = "ml_z_gcd"
val gcdext : Z.t -> Z.t -> Z.t * Z.t * Z.t
val lcm : Z.t -> Z.t -> Z.t
external powm : Z.t -> Z.t -> Z.t -> Z.t = "ml_z_powm"
external powm_sec : Z.t -> Z.t -> Z.t -> Z.t = "ml_z_powm_sec"
external invert : Z.t -> Z.t -> Z.t = "ml_z_invert"
external probab_prime : Z.t -> int -> int = "ml_z_probab_prime"
external nextprime : Z.t -> Z.t = "ml_z_nextprime"
external jacobi : Z.t -> Z.t -> int = "ml_z_jacobi"
external legendre : Z.t -> Z.t -> int = "ml_z_legendre"
external kronecker : Z.t -> Z.t -> int = "ml_z_kronecker"
external remove : Z.t -> Z.t -> Z.t * int = "ml_z_remove"
external fac : int -> Z.t = "ml_z_fac"
external fac2 : int -> Z.t = "ml_z_fac2"
external facM : int -> int -> Z.t = "ml_z_facM"
external primorial : int -> Z.t = "ml_z_primorial"
external bin : Z.t -> int -> Z.t = "ml_z_bin"
external fib : int -> Z.t = "ml_z_fib"
external lucnum : int -> Z.t = "ml_z_lucnum"
external pow : Z.t -> int -> Z.t = "ml_z_pow"
external sqrt : Z.t -> Z.t = "ml_z_sqrt"
external sqrt_rem : Z.t -> Z.t * Z.t = "ml_z_sqrt_rem"
external root : Z.t -> int -> Z.t = "ml_z_root"
external rootrem : Z.t -> int -> Z.t * Z.t = "ml_z_rootrem"
external perfect_power : Z.t -> bool = "ml_z_perfect_power"
external perfect_square : Z.t -> bool = "ml_z_perfect_square"
val log2 : Z.t -> int
val log2up : Z.t -> int
external size : Z.t -> int = "ml_z_size" [@@noalloc]
external extract : Z.t -> int -> int -> Z.t = "ml_z_extract"
val signed_extract : Z.t -> int -> int -> Z.t
external to_bits : Z.t -> string = "ml_z_to_bits"
external of_bits : string -> Z.t = "ml_z_of_bits"
val ( ~- ) : Z.t -> Z.t
val ( ~+ ) : Z.t -> Z.t
val ( + ) : Z.t -> Z.t -> Z.t
val ( - ) : Z.t -> Z.t -> Z.t
val ( * ) : Z.t -> Z.t -> Z.t
val ( / ) : Z.t -> Z.t -> Z.t
external ( /> ) : Z.t -> Z.t -> Z.t = "ml_z_cdiv"
external ( /< ) : Z.t -> Z.t -> Z.t = "ml_z_fdiv"
val ( /| ) : Z.t -> Z.t -> Z.t
val ( mod ) : Z.t -> Z.t -> Z.t
val ( land ) : Z.t -> Z.t -> Z.t
val ( lor ) : Z.t -> Z.t -> Z.t
val ( lxor ) : Z.t -> Z.t -> Z.t
val ( ~! ) : Z.t -> Z.t
val ( lsl ) : Z.t -> int -> Z.t
val ( asr ) : Z.t -> int -> Z.t
external ( ~$ ) : int -> Z.t = "%identity"
external ( ** ) : Z.t -> int -> Z.t = "ml_z_pow"
module Compare :
sig
val ( = ) : Z.t -> Z.t -> bool
val ( < ) : Z.t -> Z.t -> bool
val ( > ) : Z.t -> Z.t -> bool
val ( <= ) : Z.t -> Z.t -> bool
val ( >= ) : Z.t -> Z.t -> bool
val ( <> ) : Z.t -> Z.t -> bool
end
val version : string
val round_to_float : Z.t -> bool -> float
end