changeset 53393:6658b72a5f99

(internal_equal): Return t for two NaN arguments.
author Eli Zaretskii <eliz@is.elta.co.il>
date Mon, 29 Dec 2003 13:51:54 +0000
parents b1e278aa0593
children 269f007885af
files src/fns.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/fns.c	Mon Dec 29 13:44:14 2003 +0000
+++ b/src/fns.c	Mon Dec 29 13:51:54 2003 +0000
@@ -2169,7 +2169,15 @@
   switch (XTYPE (o1))
     {
     case Lisp_Float:
-      return (extract_float (o1) == extract_float (o2));
+      {
+	double d1, d2;
+
+	d1 = extract_float (o1);
+	d2 = extract_float (o2);
+	/* If d is a NaN, then d != d. Two NaNs should be `equal' even
+	   though they are not =. */
+	return d1 == d2 || (d1 != d1 && d2 != d2);
+      }
 
     case Lisp_Cons:
       if (!internal_equal (XCAR (o1), XCAR (o2), depth + 1))