aboutsummaryrefslogtreecommitdiffstats
path: root/flocq/Core/Fcore_FLT.v
diff options
context:
space:
mode:
authorXavier Leroy <xavierleroy@users.noreply.github.com>2018-04-25 10:43:45 +0200
committerGitHub <noreply@github.com>2018-04-25 10:43:45 +0200
commit4e8389034032a44cd2f03e965badec92e2aaa23e (patch)
tree3cb7923b90bbea16deef042ce670d0aa6b1b3be7 /flocq/Core/Fcore_FLT.v
parent1106670d8b48ec4883f66b5c43f9e8e7757006e5 (diff)
downloadcompcert-kvx-4e8389034032a44cd2f03e965badec92e2aaa23e.tar.gz
compcert-kvx-4e8389034032a44cd2f03e965badec92e2aaa23e.zip
Upgrade Flocq to version 2.6.1 from upstream (#71)
We were previously at 2.5.2. Quoting the NEWS from upstream: Version 2.6.1: - ensured compatibility from Coq 8.4 to 8.8 Version 2.6.0: - ensured compatibility from Coq 8.4 to 8.7 - removed some hypotheses on some lemmas of Fcore_ulp - added lemmas to Fprop_plus_error - improved examples Also: in preparation for Coq 8.8, silence warning "compatibility-notation" when building Flocq, because this warning is on by default in 8.8, and Flocq triggers it a lot.
Diffstat (limited to 'flocq/Core/Fcore_FLT.v')
-rw-r--r--flocq/Core/Fcore_FLT.v29
1 files changed, 15 insertions, 14 deletions
diff --git a/flocq/Core/Fcore_FLT.v b/flocq/Core/Fcore_FLT.v
index 53dc48a7..2258b1d9 100644
--- a/flocq/Core/Fcore_FLT.v
+++ b/flocq/Core/Fcore_FLT.v
@@ -257,32 +257,33 @@ apply Rle_lt_trans with (2:=Hx).
now apply He.
Qed.
-Theorem ulp_FLT_le: forall x, (bpow (emin+prec) <= Rabs x)%R ->
- (ulp beta FLT_exp x <= Rabs x * bpow (1-prec))%R.
+Theorem ulp_FLT_le :
+ forall x, (bpow (emin + prec - 1) <= Rabs x)%R ->
+ (ulp beta FLT_exp x <= Rabs x * bpow (1 - prec))%R.
Proof.
intros x Hx.
-assert (x <> 0)%R.
-intros Z; contradict Hx; apply Rgt_not_le, Rlt_gt.
-rewrite Z, Rabs_R0; apply bpow_gt_0.
-rewrite ulp_neq_0; try assumption.
+assert (Zx : (x <> 0)%R).
+ intros Z; contradict Hx; apply Rgt_not_le, Rlt_gt.
+ rewrite Z, Rabs_R0; apply bpow_gt_0.
+rewrite ulp_neq_0 with (1 := Zx).
unfold canonic_exp, FLT_exp.
destruct (ln_beta beta x) as (e,He).
apply Rle_trans with (bpow (e-1)*bpow (1-prec))%R.
rewrite <- bpow_plus.
right; apply f_equal.
-apply trans_eq with (e-prec)%Z;[idtac|ring].
-simpl; apply Z.max_l.
-assert (emin+prec <= e)%Z; try omega.
-apply le_bpow with beta.
-apply Rle_trans with (1:=Hx).
-left; now apply He.
+replace (e - 1 + (1 - prec))%Z with (e - prec)%Z by ring.
+apply Z.max_l.
+assert (emin+prec-1 < e)%Z; try omega.
+apply lt_bpow with beta.
+apply Rle_lt_trans with (1:=Hx).
+now apply He.
apply Rmult_le_compat_r.
apply bpow_ge_0.
now apply He.
Qed.
-
-Theorem ulp_FLT_ge: forall x, (Rabs x * bpow (-prec) < ulp beta FLT_exp x)%R.
+Theorem ulp_FLT_gt :
+ forall x, (Rabs x * bpow (-prec) < ulp beta FLT_exp x)%R.
Proof.
intros x; case (Req_dec x 0); intros Hx.
rewrite Hx, ulp_FLT_small, Rabs_R0, Rmult_0_l; try apply bpow_gt_0.