Skip to content

Latest commit

 

History

History
33 lines (22 loc) · 961 Bytes

README.md

File metadata and controls

33 lines (22 loc) · 961 Bytes

nuid.bn

Cross-platform arbitrary precision integers.

Requirements

jvm, node + npm, clj, shadow-cljs

Clojure and ClojureScript

tools.deps:

{nuid/bn {:git/url "https://github.com/nuid/bn" :sha "..."}}

usage:

$ clj # or shadow-cljs node-repl
=> (require '[nuid.bn :as bn])
=> (def a (bn/from "42"))
=> (def b (bn/from "14159265358979323846264338327950288419716939937510"))
=> (def c (bn/add a b))
=> (bn/eq? a b)  ;; => false
=> (bn/lt? a b)  ;; => true
=> (bn/str c)    ;; => "14159265358979323846264338327950288419716939937552"
=> (bn/str c 16) ;; => "9b02b6aef2f4c6d5f1a5aae08bf77321e33e47710"

Licensing

Apache v2.0 or MIT