Public Vars

Back

parse-double (clj)

(source)

function

(parse-double s)
Parse string with floating point components and return a Double value, or nil if parse fails. Grammar: https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html#valueOf-java.lang.String-

Examples

originrose/cortex
(ns cortex.util-test
  (:refer-clojure :exclude [defonce])
  (:require
    #?(:cljs [cljs.test :refer-macros [deftest is testing]]
       :clj [clojure.test :refer [deftest is testing]])
    [clojure.core.matrix :as m]
    [clojure.string :as str]
    [cortex.util :refer :all]))

(deftest parse-double-test
  (is (= (parse-double "5") 5.0))
  (is (= (parse-double "-7.77e-7") -7.77e-7)))
originrose/cortex
(ns cortex.optimise.util-test
  (:refer-clojure :exclude [defonce])
  (:require [cortex.optimise.util :refer :all]
            [clojure.core.matrix :as m]
            [clojure.test :refer :all]))

(deftest parse-double-test
  (is (= (parse-double "5") 5.0))
  (is (= (parse-double "-7.77e-7") -7.77e-7)))
typedclojure/typedclojure
(ns ^:no-doc typed.ann.clojure
  "Type annotations for the base Clojure distribution."
  #?(:cljs (:require-macros [typed.ann-macros.clojure :as macros]))
  (:require [clojure.core :as cc]
            [typed.clojure :as t]
            #?(:clj [typed.ann-macros.clojure :as macros])
            #?(:clj typed.ann.clojure.jvm) ;; jvm annotations
            #?(:clj clojure.core.typed))
  #?(:clj
     (:import (clojure.lang PersistentHashSet PersistentList
                            APersistentMap #_IPersistentCollection
                            #_ITransientSet
                            IRef)
              (java.util Comparator Collection))))

;coercions
#?@(:cljs [] :default [
cc/bigdec [(t/U t/Str t/Num) :-> BigDecimal]
cc/bigint [(t/U t/Str t/Num) :-> clojure.lang.BigInt]
cc/biginteger [(t/U t/Str t/Num) :-> java.math.BigInteger]
])
cc/boolean [t/Any :-> t/Bool]
cc/parse-boolean [t/Str :-> (t/Option t/Bool)]
cc/byte [(t/U Character t/Num) :-> Byte]
#?@(:cljs [
cc/char [(t/U t/Str t/Num) :-> t/Str]
] :default [
cc/char [(t/U Character t/Num) :-> Character]
])
cc/double [t/Num :-> #?(:cljs t/Num :default Double)]
cc/parse-double [t/Str :-> (t/Option #?(:cljs t/Num :default Double))]
babashka/sci.configs
(ns sci.configs.clojure-1-11
  (:require [sci.core :as sci]
            [sci.impl.utils :refer [clojure-core-ns]]
            [clojure.core :as c]))

(def ^:private clojure-core-namespace-extras-1-11
  {'abs (sci/copy-var c/abs clojure-core-ns)
   'NaN? (sci/copy-var c/NaN? clojure-core-ns)
   'infinite? (sci/copy-var c/infinite? clojure-core-ns)
   'parse-double (sci/copy-var c/parse-double clojure-core-ns)
   'parse-long (sci/copy-var c/parse-long clojure-core-ns)
   'parse-boolean (sci/copy-var c/parse-boolean clojure-core-ns)
   'parse-uuid (sci/copy-var c/parse-uuid clojure-core-ns)
   'random-uuid (sci/copy-var c/random-uuid clojure-core-ns)
   'update-keys (sci/copy-var c/update-keys clojure-core-ns)
   'update-vals (sci/copy-var c/update-vals clojure-core-ns)
   'iteration (sci/copy-var c/iteration clojure-core-ns)})