(* $Id: rational.ml,v 1.7 2008/01/30 19:45:10 averell Exp $ *) open Num type t = num let of_int z = Int z let of_string st = num_of_string st let zero = of_int 0 let one = of_int 1 let ( +/ ) = add_num let ( -/ ) = sub_num let ( */ ) = mult_num let ( // ) = div_num let ( =/ ) = eq_num let is_zero = eq_num zero let invert n = div_num one n let negate = minus_num let pow n i = power_num n (Int i) let to_string = string_of_num let fprint ppf n = Format.fprintf ppf "%s" (string_of_num n) let print = fprint Format.std_formatter