aboutsummaryrefslogtreecommitdiffstats
path: root/flocq/Calc/Round.v
diff options
context:
space:
mode:
Diffstat (limited to 'flocq/Calc/Round.v')
-rw-r--r--flocq/Calc/Round.v16
1 files changed, 16 insertions, 0 deletions
diff --git a/flocq/Calc/Round.v b/flocq/Calc/Round.v
index 40da2f08..b4693ed7 100644
--- a/flocq/Calc/Round.v
+++ b/flocq/Calc/Round.v
@@ -114,6 +114,12 @@ Qed.
Definition cond_incr (b : bool) m := if b then (m + 1)%Z else m.
+Lemma le_cond_incr_le :
+ forall b m, (m <= cond_incr b m <= m + 1)%Z.
+Proof.
+unfold cond_incr; intros b; case b; lia.
+Qed.
+
Theorem inbetween_float_round_sign :
forall rnd choice,
( forall x m l, inbetween_int m (Rabs x) l ->
@@ -590,6 +596,16 @@ now case Rlt_bool.
lia.
Qed.
+Theorem inbetween_float_NA_sign :
+ forall x m l,
+ let e := cexp beta fexp x in
+ inbetween_float beta m e (Rabs x) l ->
+ round beta fexp ZnearestA x = F2R (Float beta (cond_Zopp (Rlt_bool x 0) (cond_incr (round_N true l) m)) e).
+Proof.
+apply inbetween_float_round_sign with (choice := fun s m l => cond_incr (round_N true l) m).
+exact inbetween_int_NA_sign.
+Qed.
+
Definition truncate_aux t k :=
let '(m, e, l) := t in
let p := Zpower beta k in