mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-03-10 23:20:23 -07:00
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:
parent
046c6b9f32
commit
a597fd5379
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue