Global Instance valid_rnd_N : Valid_rnd Znearest.

(* Specifications: *)
Theorem Rcompare_floor_ceil_mid :
forall x,
Z2R (Zfloor x) <> x ->
Rcompare (x - Z2R (Zfloor x)) (/ 2) = Rcompare (x - Z2R (Zfloor x)) (Z2R (Zceil x) - x).
Theorem Rcompare_ceil_floor_mid :
forall x,
Z2R (Zfloor x) <> x ->
Rcompare (Z2R (Zceil x) - x) (/ 2) = Rcompare (Z2R (Zceil x) - x) (x - Z2R (Zfloor x)).
Theorem Znearest_N_strict :
forall x,
(x - Z2R (Zfloor x) <> /2)%R ->
(Rabs (x - Z2R (Znearest x)) < /2)%R.
Theorem Znearest_N :
forall x,
(Rabs (x - Z2R (Znearest x)) <= /2)%R.
Theorem Znearest_imp :
forall x n,
(Rabs (x - Z2R n) < /2)%R ->
Znearest x = n.
Theorem round_N_pt :
forall x,
Rnd_N_pt generic_format x (round Znearest x).
Theorem round_N_middle :
forall x,
(x - round Zfloor x = round Zceil x - x)%R ->
round Znearest x = if choice (Zfloor (scaled_mantissa x)) then round Zceil x else round Zfloor x.
Lemma round_N_really_small_pos :
forall x,
forall ex,
(Fcore_Raux.bpow beta (ex - 1) <= x < Fcore_Raux.bpow beta ex)%R ->
(ex < fexp ex)%Z ->
(round Znearest x = 0)%R.
Theorem Rcompare_floor_ceil_mid :
forall x,
Z2R (Zfloor x) <> x ->
Rcompare (x - Z2R (Zfloor x)) (/ 2) = Rcompare (x - Z2R (Zfloor x)) (Z2R (Zceil x) - x).
Theorem Rcompare_ceil_floor_mid :
forall x,
Z2R (Zfloor x) <> x ->
Rcompare (Z2R (Zceil x) - x) (/ 2) = Rcompare (Z2R (Zceil x) - x) (x - Z2R (Zfloor x)).
Theorem Znearest_N_strict :
forall x,
(x - Z2R (Zfloor x) <> /2)%R ->
(Rabs (x - Z2R (Znearest x)) < /2)%R.
Theorem Znearest_N :
forall x,
(Rabs (x - Z2R (Znearest x)) <= /2)%R.
Theorem Znearest_imp :
forall x n,
(Rabs (x - Z2R n) < /2)%R ->
Znearest x = n.
Theorem round_N_pt :
forall x,
Rnd_N_pt generic_format x (round Znearest x).
Theorem round_N_middle :
forall x,
(x - round Zfloor x = round Zceil x - x)%R ->
round Znearest x = if choice (Zfloor (scaled_mantissa x)) then round Zceil x else round Zfloor x.
Lemma round_N_really_small_pos :
forall x,
forall ex,
(Fcore_Raux.bpow beta (ex - 1) <= x < Fcore_Raux.bpow beta ex)%R ->
(ex < fexp ex)%Z ->
(round Znearest x = 0)%R.