##NaN

known as "Not a Number"
symbolic valuesince v1.9.946Edit

Floating point representation of NaN (not a number), an undefined or unrepresentable number.


Details:

To test for NaN, use the native JavaScript js/isNaN or the safer js/Number.isNaN.


Examples:

##NaN
;;=> ##NaN

Testing for NaN:

(js/Number.isNaN ##NaN)
;;=> true

(js/Number.isNaN (/ 0 0))
;;=> true

(js/Number.isNaN 1)
;;=> false

Equivalent to the JavaScript symbol:

js/NaN
;;=> ##NaN

See Also:


Reader code @ tools.reader:src/main/clojure/clojure/tools/reader.clj
(defn- read-symbolic-value
  [rdr _ opts pending-forms]
  (let [sym (read* rdr true nil opts pending-forms)]
    (case sym
      Inf Double/POSITIVE_INFINITY
      -Inf Double/NEGATIVE_INFINITY
      NaN Double/NaN
      (err/reader-error rdr (str "Invalid token: ##" sym)))))

Reader table @ tools.reader:src/main/clojure/clojure/tools/reader.clj
(defn- dispatch-macros [ch]
  (case ch
    \^ read-meta                ;deprecated
    \' (wrapping-reader 'var)
    \( read-fn
    \= read-eval
    \{ read-set
    \< (throwing-reader "Unreadable form")
    \" read-regex
    \! read-comment
    \_ read-discard
    \? read-cond
    \: read-namespaced-map
    \# read-symbolic-value
    nil))