aboutsummaryrefslogtreecommitdiff
path: root/kernel/byterun/coq_float64.h
diff options
context:
space:
mode:
authorErik Martin-Dorel2019-07-03 15:08:44 +0200
committerPierre Roux2019-11-01 10:21:16 +0100
commitf155ba664a782f000e278d97ee5666e2e7d2adea (patch)
treec7d9ddacde2059e4fa4745ce32395b9150764a1e /kernel/byterun/coq_float64.h
parentf8fdc27f922694edf74a7b608de1596e0a1ac0e3 (diff)
Add "==", "<", "<=" in PrimFloat.v
* Add a related test-suite in compare.v (generated by a bash script) Co-authored-by: Pierre Roux <pierre.roux@onera.fr>
Diffstat (limited to 'kernel/byterun/coq_float64.h')
-rw-r--r--kernel/byterun/coq_float64.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/byterun/coq_float64.h b/kernel/byterun/coq_float64.h
index 9fc390bd33..c41079c8ff 100644
--- a/kernel/byterun/coq_float64.h
+++ b/kernel/byterun/coq_float64.h
@@ -3,6 +3,15 @@
#include <math.h>
+#define DECLARE_FREL(name, e) \
+ int coq_##name(double x, double y) { \
+ return e; \
+ } \
+ \
+ value coq_##name##_byte(value x, value y) { \
+ return coq_##name(Double_val(x), Double_val(y)); \
+ }
+
#define DECLARE_FBINOP(name, e) \
double coq_##name(double x, double y) { \
return e; \
@@ -21,6 +30,9 @@
return caml_copy_double(coq_##name(Double_val(x))); \
}
+DECLARE_FREL(feq, x == y)
+DECLARE_FREL(flt, x < y)
+DECLARE_FREL(fle, x <= y)
DECLARE_FBINOP(fmul, x * y)
DECLARE_FBINOP(fadd, x + y)
DECLARE_FBINOP(fsub, x - y)