Corollary round_odd_fix:
  forall x p choice,
  prec > 1 ->
  0 <= p ->
  (bpow radix2 (prec + p + 1) <= Rabs x)%R ->
  round radix2 fexp (Znearest choice) (round radix2 (FIX_exp p) Zrnd_odd x) =
  round radix2 fexp (Znearest choice) x.Definition int_round_odd (x: Z) (p: Z) :=
  (if Z.eqb (x mod 2^p) 0 || Z.odd (x / 2^p) then x / 2^p else x / 2^p + 1) * 2^p.

(* Specifications: *)
Lemma Zrnd_odd_int: forall n p, 0 <= p -> Zrnd_odd (Z2R n * bpow radix2 (-p)) * 2^p = int_round_odd n p.
Lemma int_round_odd_le: forall p x y, 0 <= p -> x <= y -> int_round_odd x p <= int_round_odd y p.
Theorem BofZ_round_odd: forall x p, prec > 1 -> Z.abs x <= 2^emax - 2^(emax-prec) -> 0 <= p <= emax - prec -> 2^(prec + p + 1) <= Z.abs x -> BofZ x = BofZ (int_round_odd x p).
Lemma int_round_odd_shifts: forall x p, 0 <= p -> int_round_odd x p = Z.shiftl (if Z.eqb (x mod 2^p) 0 then Z.shiftr x p else Z.lor (Z.shiftr x p) 1) p.
Lemma int_round_odd_bits: forall x y p, 0 <= p -> (forall i, 0 <= i < p -> Z.testbit y i = false) -> Z.testbit y p = (if Z.eqb (x mod 2^p) 0 then Z.testbit x p else true) -> (forall i, p < i -> Z.testbit y i = Z.testbit x i) -> int_round_odd x p = y.
Lemma Zrnd_odd_int: forall n p, 0 <= p -> Zrnd_odd (Z2R n * bpow radix2 (-p)) * 2^p = int_round_odd n p.
Lemma int_round_odd_le: forall p x y, 0 <= p -> x <= y -> int_round_odd x p <= int_round_odd y p.
Theorem BofZ_round_odd: forall x p, prec > 1 -> Z.abs x <= 2^emax - 2^(emax-prec) -> 0 <= p <= emax - prec -> 2^(prec + p + 1) <= Z.abs x -> BofZ x = BofZ (int_round_odd x p).
Lemma int_round_odd_shifts: forall x p, 0 <= p -> int_round_odd x p = Z.shiftl (if Z.eqb (x mod 2^p) 0 then Z.shiftr x p else Z.lor (Z.shiftr x p) 1) p.
Lemma int_round_odd_bits: forall x y p, 0 <= p -> (forall i, 0 <= i < p -> Z.testbit y i = false) -> Z.testbit y p = (if Z.eqb (x mod 2^p) 0 then Z.testbit x p else true) -> (forall i, p < i -> Z.testbit y i = Z.testbit x i) -> int_round_odd x p = y.