Skip to content

quoll/cljs-math

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cljs-math

A ClojureScript port of clojure.math

Notice

This code is now merged (along with some improvements) into ClojureScript. It first appeared in the ClojureScript 1.11.51 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:

clj -X:test

License

Copyright © 2021-2022 Paula Gearon

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

About

A ClojureScript port of clojure.java.math

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •