fact: Definition of_decimal (d:Decimal.decimal) : IQ := let '(i, f, e) := match d with | Decimal.Decimal i f => (i, f, Decimal.Pos Decimal.Nil) | Decimal.DecimalExp i f e => (i, f, e) end in let num := Z.of_int (Decimal.app_int i f) in let den := Nat.iter (Decimal.nb_digits f) (Pos.mul 10) 1%positive in let q := IQmake (IZ_of_Z num) den in let e := Z.of_int e in match e with | Z0 => q | Zpos e => IQmult q (IQmake (IZpow_pos 10 e) 1) | Zneg e => IQdiv q (IQmake (IZpow_pos 10 e) 1) end.
imports: ZArith_base ZArithRing ZArith.BinInt Morphisms Setoid Bool