Subject: [clisp-list] bug in eql

From: bernard URBAN <[email-masked]>
Date: 27 Jul 2000 18:28:48 +0200

Hello!

Here a serious bug:

[6]> (lisp-implementation-version)
"2000-03-06 (March 2000)"
[7]> (eql -3.14159s0 3.14159s0)
NIL
[8]> (eql -3.14159e0 3.14159e0)
NIL
[9]> (eql -3.14159d0 3.14159d0)
NIL
[10]> (eql -3.14159l0 3.14159l0)
T
[11]> (eql (- pi) pi)
T

This bug is also the probable cause of bug 104646, as the declaration
(real (* -2 pi) (* 2 pi)) becomes (real (* -2 pi) (* -2 pi)).

The reason seems that in the case of long float, the sign bit is not
tested (it appears not to be in the mantissa as for the other float
sizes).

-- 

B. Urban

---

From: Bruno Haible <[email-masked]>
Date: Thu, 27 Jul 2000 20:24:19 +0200 (CEST)

> T

Thanks for reporting it. Here is a fix.

diff -c -3 -r1.29 predtype.d
*** predtype.d  2000/06/13 19:02:12     1.29
--- predtype.d  2000/07/27 18:10:01
***************
*** 94,99 ****
--- 94,105 ----
              if (!(len1 == Lfloat_length(obj2))) goto no;
              # Exponenten vergleichen:
              if (!(TheLfloat(obj1)->expo == TheLfloat(obj2)->expo)) goto no;
+             # Vorzeichen vergleichen: (LF_sign not usable here.)
+             #ifdef TYPECODES
+             if (R_sign(as_object(as_oint(obj1) ^ as_oint(obj2))) < 0) goto no;
+             #else
+             if (Record_flags(obj1) != Record_flags(obj2)) goto no;
+             #endif
              # Ziffern vergleichen:
              var uintD* ptr1 = &TheLfloat(obj1)->data[0];
              var uintD* ptr2 = &TheLfloat(obj2)->data[0];

Bruno