KO
|
EN
gitlite โ search
Search
#javascript
#python
#hacktoberfest
#react
#ai
#typescript
#llm
#go
#golang
#android
#machine-learning
#rust
#deep-learning
#linux
precise
โ 9
Open GitHub โ
Tagged literals for exact
Download README (.md)
Explore Similar Repositories
lunespy
:
๐ฆ Library for communication with nodes in mainnet or testnet of the lunes-blockchain network Allows the automation of sending assets, issue end reissue tokens, leasing, registry, and create new wallet.
RTCEngine-ios-sdk
:
RTCEngine-ios-sdk
pisdui
:
.psd file resource block interpreter in go
probot-ui
:
Browser extension to show custom events from your Probot App in the GitHub timeline
bianchi
:
Matlab/Octave script to study Bianchi's model for both IEEE 802.11n and 802.11ac standards
// repository documentation
Was this content helpful?
โ 0
(0 ratings)
Select Rating:
โ
โ
โ
โ
โ
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
precise
?
Download (.md)
# precise Tagged literals for [exact](https://github.com/gfredericks/exact). [](https://clojars.org/precise) ## Usage `deps.edn`: ```clojure {:deps {org.clojure/clojurescript {:mvn/version "1.10.339"} precise {:mvn/version "0.1.0"}}} ``` Start a ClojureScript REPL using ``` clj -i @precise/tagged_literals.cljc -m cljs.main ``` or a Planck REPL using ``` plk ``` or a Lumo REPL using ``` lumo -c `clojure -Spath` ``` or even a Clojure REPL (where the tagged literals are read, but not printed): ``` clj ``` Require the tagged literals and exact namespaces: ``` cljs.user=> (require 'precise.tagged-literals '[com.gfredericks.exact :as e]) ``` Try using `#exact/integer` and `#exact/ratio`: ``` cljs.user=> #exact/integer "2319871239717122424323214112455623" #exact/integer "2319871239717122424323214112455623" cljs.user=> #exact/ratio "2/3" #exact/ratio "2/3" cljs.user=> (e/numerator *1) #exact/integer "2" ``` > Note that, even though the `#exact/integer` tagged literal works in terms of an arbitrary-length string of base-10 digits, in ClojureScript the underlying data is a `goog.math.Integer` instance, which is efficiently implemented using an array of 32-bit signed pieces. Similarly, `#exact/ratio` affords a string-based literal representation of an implementation that involves a pair of such integers. Newtonian square root [example](https://github.com/gfredericks/exact/blob/master/README.md#usage): ``` cljs.user=> (def TWO #exact/integer "2") #'cljs.user/TWO cljs.user=> (defn square [x] (e/* x x)) #'cljs.user/square cljs.user=> (defn avg [a b] (-> a (e/+ b) (e// TWO))) #'cljs.user/avg cljs.user=> (defn newtonian-square-root "Returns a ratio between (- (sqrt x) epsilon) and (+ (sqrt x) epsilon)" [x epsilon] (let [ee (square epsilon)] (loop [guess (avg x e/ZERO)] (if (-> guess square (e/- x) e/abs (e/< ee)) guess (recur (-> x (e// guess) (avg guess))))))) #'cljs.user/newtonian-square-root cljs.user=> (def epsilon (e// #exact/integer "1000000000000000000000000")) #'cljs.user/epsilon cljs.user=> epsilon #exact/ratio "1/1000000000000000000000000" cljs.user=> (newtonian-square-root TWO epsilon) #exact/ratio "1572584048032918633353217/1111984844349868137938112" ```