guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 01/08: Fix error when argument to < not a real


From: Andy Wingo
Subject: [Guile-commits] 01/08: Fix error when argument to < not a real
Date: Mon, 26 Apr 2021 11:04:10 -0400 (EDT)

wingo pushed a commit to branch wip-inlinable-exports
in repository guile.

commit e0d022c347a9eb9835c6b0ac6e5fabc50e77ff69
Author: Andy Wingo <wingo@pobox.com>
AuthorDate: Mon Apr 26 12:26:33 2021 +0200

    Fix error when argument to < not a real
    
    * libguile/intrinsics.c (less_p): scm_nan_p raises an error if arg is
    not a real; guard.
---
 libguile/intrinsics.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libguile/intrinsics.c b/libguile/intrinsics.c
index 10f897a..8ad64fa 100644
--- a/libguile/intrinsics.c
+++ b/libguile/intrinsics.c
@@ -291,7 +291,8 @@ less_p (SCM a, SCM b)
       return a_bits < b_bits ? SCM_F_COMPARE_LESS_THAN : SCM_F_COMPARE_NONE;
     }
 
-  if (scm_is_true (scm_nan_p (a)) || scm_is_true (scm_nan_p (b)))
+  if ((SCM_REALP (a) && scm_is_true (scm_nan_p (a)))
+      || (SCM_REALP (b) && scm_is_true (scm_nan_p (b))))
     return SCM_F_COMPARE_INVALID;
   else if (scm_is_true (scm_less_p (a, b)))
     return SCM_F_COMPARE_LESS_THAN;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]