EQUALP HT fails to find float key using integer

Bug #1916300 reported by Michael Kappert
This bug report is a duplicate of:  Bug #1878653: hash table equalp and numbers. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Invalid
Undecided
Unassigned

Bug Description

GETHASH fails to find a single-float key when queried with an integer under EQUALP:

Using
CL-USER> (lisp-implementation-version)
"2.0.1-4.fc33"

The following sequence works as expected:
CL-USER> (defparameter *ht* (make-hash-table :test 'equalp))
*HT*
CL-USER> (setf (gethash 6 *ht*) t)
T
CL-USER> (gethash 6 *ht*)
T
T
CL-USER> (gethash 6.0 *ht*)
T
T

By contrast, retreiving a single-float key using an integer does not work:

CL-USER> (defparameter *ht* (make-hash-table :test 'equalp))
*HT*
CL-USER> (setf (gethash 6.0 *ht*) t)
T
CL-USER> (gethash 6.0 *ht*)
T
T
CL-USER> (gethash 6 *ht*)
NIL
NIL

CL-USER> *features*
(:SWANK :CL-FAD :BORDEAUX-THREADS :THREAD-SUPPORT CFFI-FEATURES:FLAT-NAMESPACE
 CFFI-FEATURES:X86-64 CFFI-FEATURES:UNIX :CFFI CFFI-SYS::FLAT-NAMESPACE
 :SPLIT-SEQUENCE :SBCL-USES-SB-ROTATE-BYTE :QUICKLISP :SB-BSD-SOCKETS-ADDRINFO
 :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX
 :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :X86-64 :64-BIT :ANSI-CL :COMMON-LISP
 :ELF :GENCGC :IEEE-FLOATING-POINT :LINUX :LITTLE-ENDIAN
 :PACKAGE-LOCAL-NICKNAMES :SB-CORE-COMPRESSION :SB-LDB :SB-PACKAGE-LOCKS
 :SB-THREAD :SB-UNICODE :SBCL :UNIX)
CL-USER>

$ uname -a
Linux aguas-13 5.10.15-200.fc33.x86_64 #1 SMP Wed Feb 10 17:46:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Revision history for this message
Stas Boukarev (stassats) wrote :

>2.0.1

That's too old.

Changed in sbcl:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.