Skip to content
Snippets Groups Projects
Commit 080cdaa8 authored by pfdietz's avatar pfdietz
Browse files

Added a note for similarity of 0.0 and -0.0

parent 6e998f44
No related branches found
No related tags found
No related merge requests found
......@@ -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.")
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment