Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nuid/bn
Cross-platform arbitrary precision integers
https://github.com/nuid/bn
bigint biginteger bignum bignumber clj cljc cljs clojure clojurescript
Last synced: 1 day ago
JSON representation
Cross-platform arbitrary precision integers
- Host: GitHub
- URL: https://github.com/nuid/bn
- Owner: NuID
- License: apache-2.0
- Created: 2018-11-20T20:31:22.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2023-10-27T13:31:58.000Z (about 1 year ago)
- Last Synced: 2024-10-19T18:18:05.706Z (about 1 month ago)
- Topics: bigint, biginteger, bignum, bignumber, clj, cljc, cljs, clojure, clojurescript
- Language: Clojure
- Homepage:
- Size: 119 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE.md
Awesome Lists containing this project
README
# nuid.bn
Cross-platform arbitrary precision integers.
## Requirements
[`jvm`](https://www.java.com/en/download/), [`node + npm`](https://nodejs.org/en/download/), [`clj`](https://clojure.org/guides/getting_started), [`shadow-cljs`](https://shadow-cljs.github.io/docs/UsersGuide.html#_installation)
## 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