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
This commit is contained in:
Marius Gerbershagen 2019-03-11 18:51:42 +01:00
parent 046c6b9f32
commit a597fd5379

View file

@ -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