Skip to content

Files

Latest commit

 

History

History
 
 

complex

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

cljsjs/complex

[cljsjs/complex "2.0.11-0"] ;; latest release

This jar comes with deps.cljs as used by the [Foreign Libs][flibs] feature of the ClojureScript compiler. After adding the above dependency to your project you can require the packaged library like so:

(ns application.core
  (:require cljsjs.complex))

This package also supports :global-exports:

(ns application.core
  (:require ["complex.js" :as complex]))

This works too:

(ns application.core
  (:require [cljsjs.complex :as complex]))

Complex.js is a well tested JavaScript library to work with complex number arithmetic in JavaScript. It implements every elementary complex number manipulation function and the API is intentionally similar to Fraction.js. Furthermore, it's the basis of Polynomial.js and Math.js.

Example usage from Clojurescript:

(ns example.core
  (:require ["complex.js" :as Complex]))

(extend-type Complex
  IEquiv
  (-equiv [this other]
    (.equals this other)))

(= 1 (.-re (Complex. 1 2)))
;; => true