Some ways of comparing equality between NaN and 'itself' return true

Description

Most ways of checking = of ##NaN to another ##NaN object/primitive return false, which while surprising to many people when they first encounter the behavior, is actually a somewhat reasonable thing to do according to the IEEE 754 specification. In most cases Clojure does this, e.g.:

While most Clojure expressions satisfy the proposed property below, there are a few variations that return results that violate it:

Property 1: Calls to Clojure `=` or `==` involving at least one NaN
return false, whether the call is inlined or not. Calls to Clojure
`not=` involving at least one NaN return true.

Examples of expressions that violate it:

Environment

None

Activity

Show:
Andy Fingerhut
July 19, 2019, 5:53 PM

Here is a Github repository that helps to quickly evaluate many similar expressions and check their results against current Clojure 1.10.1 behavior:

I have not seen any differences between Clojure 1.9.0 and 1.10.1 in this regard, and have not looked back to older Clojure versions to see if anything has changed in this area.

Assignee

Unassigned

Reporter

Andy Fingerhut

Labels

Approval

Triaged

Patch

None

Affects versions

Priority

Minor