package alt-ergo-lib

  1. Overview
  2. Docs

Rationals implementation. *

type t
exception Not_a_float
val num : t -> Z.t
val den : t -> Z.t
val zero : t
val one : t
val m_one : t
val compare : t -> t -> int
val compare_to_0 : t -> int
val equal : t -> t -> bool
val sign : t -> int
val hash : t -> int
val is_zero : t -> bool
val is_one : t -> bool
val is_m_one : t -> bool
val is_int : t -> bool
val add : t -> t -> t
val sub : t -> t -> t
val mult : t -> t -> t
val div : t -> t -> t
val minus : t -> t
val abs : t -> t
val min : t -> t -> t
val max : t -> t -> t
val inv : t -> t
val modulo : t -> t -> t
val from_float : float -> t
val from_int : int -> t
val from_z : Z.t -> t
val from_zz : Z.t -> Z.t -> t
val from_string : string -> t
val to_float : t -> float
val to_z : t -> Z.t
val to_string : t -> string
val print : Stdlib.Format.formatter -> t -> unit
val power : t -> int -> t
val floor : t -> t
val ceiling : t -> t
val truncate : t -> Z.t

converts the argument to an integer by truncation. *

val mult_2exp : t -> int -> t

multiplies the first argument by 2^(the second argument)

val div_2exp : t -> int -> t

divides the first argument by 2^(the second argument)

val root_default : t -> int -> t option
val root_excess : t -> int -> t option
val sqrt_default : t -> t option
val sqrt_excess : t -> t option
OCaml

Innovation. Community. Security.