aboutsummaryrefslogtreecommitdiffstats
path: root/flocq/Calc
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@inria.fr>2022-04-26 11:14:06 +0200
committerGuillaume Melquiond <guillaume.melquiond@inria.fr>2022-04-26 11:14:06 +0200
commite8c312eecf96ae1703f7ba0b65f107233d340238 (patch)
treef05cdd8084fcbc2098bbad14dc5b3fe38bf34ba4 /flocq/Calc
parenta4da014c354bff05c24210e694a3b4593d3f38ee (diff)
downloadcompcert-e8c312eecf96ae1703f7ba0b65f107233d340238.tar.gz
compcert-e8c312eecf96ae1703f7ba0b65f107233d340238.zip
Upgrade to Flocq 4.1.
Diffstat (limited to 'flocq/Calc')
-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