From 080cdaa81f106328123ddeaf3147f7d9e7ab089b Mon Sep 17 00:00:00 2001 From: pfdietz <pfdietz@localhost> Date: Sun, 16 May 2004 11:51:33 +0000 Subject: [PATCH] Added a note for similarity of 0.0 and -0.0 --- ansi-tests/notes.lsp | 2 ++ ansi-tests/sxhash.lsp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/ansi-tests/notes.lsp b/ansi-tests/notes.lsp index 5f24241c..9dfa70c3 100644 --- a/ansi-tests/notes.lsp +++ b/ansi-tests/notes.lsp @@ -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.") diff --git a/ansi-tests/sxhash.lsp b/ansi-tests/sxhash.lsp index e2198d27..17ed505b 100644 --- a/ansi-tests/sxhash.lsp +++ b/ansi-tests/sxhash.lsp @@ -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) -- GitLab