package libabsolute

  1. Overview
  2. Docs

Rational arithmetic module

type t = Mpqf.t

Constructors

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

Operators

val add : t -> t -> t
val sub : t -> t -> t
val mul : t -> t -> t
val div : t -> t -> t option
val pow : t -> int -> t
val neg : t -> t
val ceil : t -> int
val floor : t -> int
val to_int : t -> int option

Conversions

val to_float : t -> float
val to_rational : t -> t
val of_int : int -> t
val of_float : float -> t
val of_rational : 'a -> 'a

Comparisons

val equal : t -> t -> bool
val compare : t -> t -> int

Printing

val pp_print_size_of_0_suffix : t -> string

Mpqf human understandable printing when denominator is a power of ten

val pp_print : Stdlib.Format.formatter -> t -> unit

Mpqf light printing when convertible to a float

val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string