Commit 080cdaa8 authored by pfdietz's avatar pfdietz
Browse files

Added a note for similarity of 0.0 and -0.0

parent 6e998f44
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -31,3 +31,5 @@

#+sbcl (rt::disable-note :open-if-exists-new-version-no-error)

(defnote :negative-zero-is-similar-to-positive-zero
  "The definition of similarity implies that -0.0 and 0.0 are similar (for each float type.)  If negative zeros are distinct this is probably not good, since it makes (defconstant x 0.0) be nonportable.")
+4 −0
Original line number Diff line number Diff line
@@ -152,8 +152,10 @@
;;; Since similarity of numbers is 'same type and same mathematical value',
;;; and since sxhash must produce the same value for similar numeric arguments,
;;; (sxhash 0.0) and (sxhash -0.0) must be eql for all float types.
;;; This may be a spec bug, so I've added a note.

(deftest sxhash.17
  :notes (:negative-zero-is-similar-to-positive-zero)
  (loop for c1 in '(0.0s0 0.0f0 0.0d0 0.0l0)
	for c2 in '(-0.0s0 -0.0f0 -0.0d0 -0.0l0)
	for t1 = (type-of c1)
@@ -167,6 +169,7 @@
  nil)

(deftest sxhash.18
  :notes (:negative-zero-is-similar-to-positive-zero)
  (loop for r1 in '(0.0s0 0.0f0 0.0d0 0.0l0)
	for c1 = (complex r1)
	for r2 in '(-0.0s0 -0.0f0 -0.0d0 -0.0l0)
@@ -182,6 +185,7 @@
  nil)

(deftest sxhash.19
  :notes (:negative-zero-is-similar-to-positive-zero)
  (loop for r1 in '(0.0s0 0.0f0 0.0d0 0.0l0)
	for c1 = (complex 0 r1)
	for r2 in '(-0.0s0 -0.0f0 -0.0d0 -0.0l0)