parse-double

functionsince v1.11.50Edit
(parse-double s)

Source docstring:
Parse string with floating point components and return a floating point value,
or nil if parse fails.
Grammar: https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html#valueOf-java.lang.String-
Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn ^number parse-double
  [s]
  (if (string? s)
    (cond
      ^boolean (re-matches #"[\x00-\x20]*[+-]?NaN[\x00-\x20]*" s) ##NaN
      ^boolean (re-matches
                #"[\x00-\x20]*[+-]?(Infinity|((\d+\.?\d*|\.\d+)([eE][+-]?\d+)?)[dDfF]?)[\x00-\x20]*"
                s) (js/parseFloat s)
      :default nil)
    (throw (js/Error. (parsing-err s)))))