Section Floor_Ceil.
(** Zfloor and Zceil *)
Definition Zfloor (x : R) := (up x - 1)%Z.
Definition Zceil (x : R) := (- Zfloor (- x))%Z.
Definition Ztrunc x := if Rlt_bool x 0 then Zceil x else Zfloor x.
Definition Zaway x := if Rlt_bool x 0 then Zfloor x else Zceil x.
End Floor_Ceil.

Theorem Rcompare_floor_ceil_middle :
forall x,
IZR (Zfloor x) <> x ->
Rcompare (x - IZR (Zfloor x)) (/ 2) = Rcompare (x - IZR (Zfloor x)) (IZR (Zceil x) - x).