mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-12 22:10:53 -05:00
20 lines
418 B
OCaml
20 lines
418 B
OCaml
|
|
|
|
module Int : Sidekick_arith.INT with type t = Z.t = struct
|
|
include Z
|
|
include Z.Compare
|
|
let pp = pp_print
|
|
end
|
|
|
|
module Rational
|
|
: Sidekick_arith.RATIONAL with type t = Q.t and type bigint = Z.t
|
|
= struct
|
|
type bigint = Z.t
|
|
include Q
|
|
let denum = den
|
|
let pp = pp_print
|
|
let hash a = Hashtbl.hash (Z.hash (num a), Z.hash (den a))
|
|
|
|
let pp_approx n out q = Format.fprintf out "%*.1f" n (Q.to_float q)
|
|
end
|
|
|