fix compilation after rebase

This commit is contained in:
Simon Cruanes 2021-12-20 13:57:41 -05:00
parent 9d3da47f3b
commit dbba6719bc
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
3 changed files with 14 additions and 2 deletions

View file

@ -45,6 +45,14 @@ module type RATIONAL = sig
val num : t -> bigint
val denum : t -> bigint
val infinity : t
(** +infinity *)
val minus_infinity : t
val is_real : t -> bool
(** A proper real, not nan/infinity *)
val pp_approx : int -> Format.formatter -> t -> unit
(** Pretty print rational with given amount of precision
(for example as a floating point number) *)

View file

@ -217,8 +217,8 @@ module Make(Q : RATIONAL)(Var: VAR)
let[@inline] (>=) a b = compare a b >= 0
let[@inline] (=) a b = compare a b = 0
let plus_inf = make Q.inf Q.zero
let minus_inf = make Q.minus_inf Q.zero
let plus_inf = make Q.infinity Q.zero
let minus_inf = make Q.minus_infinity Q.zero
let[@inline] min x y = if x <= y then x else y
let[@inline] max x y = if x >= y then x else y

View file

@ -15,6 +15,10 @@ module Rational
let pp = pp_print
let hash a = Hashtbl.hash (Z.hash (num a), Z.hash (den a))
let infinity = Q.inf
let minus_infinity = Q.minus_inf
let is_real = Q.is_real
let pp_approx n out q = Format.fprintf out "%*.1f" n (Q.to_float q)
end