package colibri2

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Algebraic number with use of rational when possible

type t = private
  1. | Q of Q.t
  2. | A of Calcium.CA.t

A allows to determine certainly if something is an integer, but is not complete for rational. So Q is always used for integer and as best effort for rational

val zero : t
val one : t
val minus_one : t

0, 1, -1.

val of_bigint : Z.t -> t
val of_z : Z.t -> t
val of_int : int -> t
val to_z : t -> Z.t
val to_int : t -> int

suppose that it is an integer

val of_q : Q.t -> t
val sign : t -> int
include Colibri2_popop_lib.Popop_stdlib.Datatype with type t := t
include Colibri2_popop_lib.Popop_stdlib.OrderedHashedType with type t := t
val equal : t -> t -> bool
val hash_fold_t : t Base.Hash.folder
module S : Colibri2_popop_lib.Map_intf.Set with type 'a M.t = 'a M.t and type M.key = M.key
include Base.Hashtbl.Key.S with type t := t
val compare : t Base__Ppx_compare_lib.compare
val sexp_of_t : t -> Sexplib0.Sexp.t
val hash : t -> int
val to_string : t -> string
val two : t
val ge : t -> t -> bool
val le : t -> t -> bool
val gt : t -> t -> bool
val lt : t -> t -> bool
val of_string : string -> t

integer

val of_string_decimal : string -> t
val floor : t -> t
val ceil : t -> t
val truncate : t -> t
val add : t -> t -> t
val sub : t -> t -> t
val neg : t -> t
val inv : t -> t
val abs : t -> t
val mul : t -> t -> t
val div : t -> t -> t
val div_t : t -> t -> t
val div_e : t -> t -> t
val div_f : t -> t -> t
val mod_t : t -> t -> t
val mod_e : t -> t -> t
val mod_f : t -> t -> t
val pow : t -> int -> t
val is_integer : t -> bool
val is_real : t -> bool
val inf : t
val minus_inf : t
val is_unsigned_integer : int -> t -> bool

is_unsigned_integer size q checks that q is an integer that fits in size bits

val none_zero : t -> t option

return None if the input is zero otherwise Some of the value

val is_zero : t -> bool
val is_not_zero : t -> bool
val gen : t QCheck.Gen.t
val shrink : t QCheck.Shrink.t
val (~-) : t -> t
val (~+) : t -> t
val (+) : t -> t -> t
val (-) : t -> t -> t
val (*) : t -> t -> t
val (/) : t -> t -> t
val min : t -> t -> t
val max : t -> t -> t
val positive_root : t -> int -> t
val positive_pow : t -> Q.t -> t

the numerator and denominator should fit in an int

val ctx : Calcium.CTX.t
OCaml

Innovation. Community. Security.