Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/quoll/cljs-math
A ClojureScript port of clojure.java.math
https://github.com/quoll/cljs-math
Last synced: about 1 month ago
JSON representation
A ClojureScript port of clojure.java.math
- Host: GitHub
- URL: https://github.com/quoll/cljs-math
- Owner: quoll
- License: epl-2.0
- Created: 2021-11-24T06:55:53.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-28T11:45:23.000Z (about 2 years ago)
- Last Synced: 2024-05-01T20:30:22.627Z (8 months ago)
- Language: Clojure
- Size: 8.33 MB
- Stars: 57
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- stars - quoll/cljs-math - A ClojureScript port of clojure.java.math \[*Eclipse Public License 2.0*\] (⭐️57) (Clojure)
- stars - quoll/cljs-math - A ClojureScript port of clojure.java.math \[*Eclipse Public License 2.0*\] (⭐️57) (Clojure)
README
# cljs-math
A ClojureScript port of [`clojure.math`](https://clojure.github.io/clojure/branch-master/clojure.math-api.html)# Notice
This code is now merged (along with some improvements) into ClojureScript. It first appeared in the [ClojureScript 1.11.51 release](https://clojurescript.org/news/2022-05-13-release).This code remains as a historical reference.
## Obsolete
This can be included in `deps.edn` by adding the following entry to the `:deps` map:
```
com.github.quoll/cljs-math {:git/tag "v0.1.3" :git/sha "39ad53c"}
```The prime focus on this library is correctness before performance. It matches `clojure.math` as closely as possible.
## Testing
Tests are run on both the JVM and through a connection to ClojureScript running on Node. For this reason, the file is `.cljc` rather than `.cljs`.Testing performs generative tests, directly comparing the results of this implementation and the implementations in `java.lang.Math`. Fortunately, the floating point representation on both platforms conforms to IEEE-754, which validates this comparison.
Only the JavaScript `Math.sin()` function is compared to the equivalent Java function, to check that built-in functions have been wrapped the same way. Some built-in functions JavaScript functions have slightly less precision than the equivalent Java function, so the variance between differing answers will be displayed.
To run the tests entirely in Java, run:
```bash
clj -X:test
```# License
Copyright © 2021-2022 Paula GearonDistributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.