aboutsummaryrefslogtreecommitdiffstats
path: root/kvx/ExtIEEE754.v
diff options
context:
space:
mode:
authorDavid Monniaux <David.Monniaux@univ-grenoble-alpes.fr>2021-12-06 19:28:40 +0100
committerDavid Monniaux <David.Monniaux@univ-grenoble-alpes.fr>2021-12-06 19:28:40 +0100
commit9e62bc5ba6af27e47b7d3f22cef8c2dd24a8fc5e (patch)
tree97042ad1a686c6eeaf0ae8ebba11b9cb2d1bf06c /kvx/ExtIEEE754.v
parent6b62e98a0809a9ac22e64f82943473994e79bfaf (diff)
downloadcompcert-kvx-9e62bc5ba6af27e47b7d3f22cef8c2dd24a8fc5e.tar.gz
compcert-kvx-9e62bc5ba6af27e47b7d3f22cef8c2dd24a8fc5e.zip
Zdiv_ne
Diffstat (limited to 'kvx/ExtIEEE754.v')
-rw-r--r--kvx/ExtIEEE754.v12
1 files changed, 12 insertions, 0 deletions
diff --git a/kvx/ExtIEEE754.v b/kvx/ExtIEEE754.v
new file mode 100644
index 00000000..095fd0cc
--- /dev/null
+++ b/kvx/ExtIEEE754.v
@@ -0,0 +1,12 @@
+Require Import Coq.ZArith.Zdiv.
+
+Open Scope Z.
+
+Definition Zdiv_ne (a b : Z) :=
+ let q := Z.div a b in
+ let q1 := Z.succ q in
+ match Z.compare (a-b*q) (b*q1-a) with
+ | Lt => q
+ | Gt => q1
+ | Eq => (if Z.even q then q else q1)
+ end.