Cross-platform arbitrary precision integers.
jvm
, node + npm
, clj
, shadow-cljs
{nuid/bn {:git/url "https://github.com/nuid/bn" :sha "..."}}
$ 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"
Apache v2.0 or MIT