> This seems like a bug:
>
> GCL (GNU Common Lisp) 2.7.1 Thu Apr 10 09:38:27 PM EDT 2025 CLtL1 git:
> Version_2_7_2pre20
>
> >(< 1.0E16 10000000000000001)
> NIL
Here is a proposed fix.
diff --git a/gcl/o/num_comp.c b/gcl/o/num_comp.c
index c4c364d54..e39f6b593 100644
--- a/gcl/o/num_comp.c
+++ b/gcl/o/num_comp.c
@@ -70,6 +70,8 @@ number_compare(object x, object y) {
return(number_compare(x, y));
case t_shortfloat:
+ if ((float)number_to_double((q=double_to_integer((double)sf(y))))==sf(y))
+ return(number_compare(x,q));
{
volatile float fx=fix(x);
dx = fx;
@@ -78,6 +80,8 @@ number_compare(object x, object y) {
goto LONGFLOAT;
case t_longfloat:
+ if (number_to_double((q=double_to_integer(lf(y))))==lf(y))
+ return(number_compare(x,q));
dx = fix(x);
dy = lf(y);
goto LONGFLOAT;
@@ -175,6 +179,8 @@ number_compare(object x, object y) {
switch (ty) {
case t_fixnum:
+ if (number_to_double((q=double_to_integer(dx)))==dx)
+ return(number_compare(q,y));
if (tx==t_shortfloat) {
volatile float fy=fix(y);