From a597fd5379aea148edbc85ae2ea720720ab9903a Mon Sep 17 00:00:00 2001 From: Marius Gerbershagen Date: Mon, 11 Mar 2019 18:51:42 +0100 Subject: [PATCH] eql: fix NaN comparison Old approach doesn't work reliably on x86_64. See e.g. > (eql (+ ext:double-float-negative-infinity ext:double-float-positive-infinity) (ext:nan)) NIL --- src/c/predicate.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c/predicate.d b/src/c/predicate.d index a14216845..87eb68f3b 100644 --- a/src/c/predicate.d +++ b/src/c/predicate.d @@ -258,7 +258,7 @@ cl_eq(cl_object x, cl_object y) #define FLOAT_EQL(name, type) \ static bool name(type a, type b) { \ if (a == b) return signbit(a) == signbit(b); \ - if (isnan(a) || isnan(b)) return !memcmp(&a, &b, sizeof(type)); \ + if (isnan(a) || isnan(b)) return isnan(a) && isnan(b); \ return 0; \ } #endif