module Mpq:GMP multi-precision rationalssig..end
type 'a tt
type m
type f
typet =m tt
set, add, ...) the first parameter of type t is an out-parameter and holds the result when the function returns. For instance, add x y z adds the values of y and z and stores the result in x.
These functions are as efficient as their C counterpart: they do not imply additional memory allocation, unlike the corresponding functions in the module Mpqf.
val canonicalize : 'a tt -> unitval print : Format.formatter -> 'a tt -> unitval init : unit -> 'a ttval set : t -> 'a tt -> unitval set_z : t -> 'a Mpz.tt -> unitval set_si : t -> int -> int -> unitval _set_str : t -> string -> int -> unitval set_str : t -> string -> base:int -> unitval swap : t -> t -> unitval init_set : 'a tt -> 'b ttval init_set_z : 'a Mpz.tt -> 'b ttval init_set_si : int -> int -> 'a ttval init_set_str : string -> base:int -> 'a ttval init_set_d : float -> 'a ttval get_d : 'a tt -> floatval set_d : t -> float -> unitval get_z : Mpz.t -> 'a tt -> unitval _get_str : int -> 'a tt -> stringval get_str : base:int -> t -> stringval to_string : 'a tt -> stringval to_float : 'a tt -> floatval of_string : string -> 'a ttval of_float : float -> 'a ttval of_int : int -> 'a ttval of_frac : int -> int -> 'a ttval of_mpz : 'a Mpz.tt -> 'b ttval of_mpz2 : 'a Mpz.tt -> 'b Mpz.tt -> 'c ttval add : t -> 'a tt -> 'b tt -> unitval sub : t -> 'a tt -> 'b tt -> unitval mul : t -> 'a tt -> 'b tt -> unitval mul_2exp : t -> 'a tt -> int -> unitval div : t -> 'a tt -> 'b tt -> unitval div_2exp : t -> 'a tt -> int -> unitval neg : t -> 'a tt -> unitval abs : t -> 'a tt -> unitval inv : t -> 'a tt -> unitval cmp : 'a tt -> 'b tt -> intval cmp_si : 'a tt -> int -> int -> intval sgn : 'a tt -> intval equal : 'a tt -> 'b tt -> boolval get_num : Mpz.t -> 'a tt -> unitval get_den : Mpz.t -> 'a tt -> unitval set_num : t -> 'a Mpz.tt -> unitval set_den : t -> 'a Mpz.tt -> unit