Section Fcalc_round_fexp.
Variable fexp : Z -> Z.
Context { valid_exp : Valid_exp fexp }.
Notation format := (generic_format beta fexp).
(** Relates location and rounding. *)
Definition cond_incr (b : bool) m := if b then (m + 1)%Z else m.
(** Relates location and rounding down. *)
Definition round_sign_DN s l :=
match l with
| loc_Exact => false
| _ => s
end.
(** Relates location and rounding up. *)
Definition round_UP l :=
match l with
| loc_Exact => false
| _ => true
end.
Definition round_sign_UP s l :=
match l with
| loc_Exact => false
| _ => negb s
end.
(** Relates location and rounding toward zero. *)
Definition round_ZR (s : bool) l :=
match l with
| loc_Exact => false
| _ => s
end.

Theorem inbetween_int_ZR :
forall x m l,
inbetween_int m x l ->
Ztrunc x = cond_incr (round_ZR (Zlt_bool m 0) l) m.