fact: Definition IQmake_to_hexadecimal num den := let num := Z.to_hex_int num in let (den, e_den) := Hexadecimal.nztail (Pos.to_hex_uint den) in match den with | Hexadecimal.D1 Hexadecimal.Nil => match e_den with | O => Some (Hexadecimal.Hexadecimal num Hexadecimal.Nil) | ne => let ai := Hexadecimal.abs num in let ni := Hexadecimal.nb_digits ai in if Nat.ltb ne ni then let i := Hexadecimal.del_tail_int ne num in let f := Hexadecimal.del_head (Nat.sub ni ne) ai in Some (Hexadecimal.Hexadecimal i f) else let z := match num with | Hexadecimal.Pos _ => Hexadecimal.Pos (Hexadecimal.zero) | Hexadecimal.Neg _ => Hexadecimal.Neg (Hexadecimal.zero) end in Some (Hexadecimal.Hexadecimal z (Nat.iter (Nat.sub ne ni) Hexadecimal.D0 ai)) end | _ => None end.
imports: ZArith_base ZArithRing ZArith.BinInt Morphisms Setoid Bool