Math/ namespace

special namespacesince v0.0-927 in clojureEdit

A special namespace for direct access to the native JavaScript Math library.

  • Math/PI => js/Math.PI

Examples:

Math constants:

Math/E
;;=> 2.718281828459045

Math/PI
;;=> 3.141592653589793

Math/SQRT2
;;=> 1.4142135623730951

Math functions:

(Math/cos 0)
;;=> 1

(Math/atan2 1 0)
;;=> 1.5707963267948966

(Math/log Math/E)
;;=> 1

(Math/pow 2 5)
;;=> 32

(Math/pow Math/E (Math/log 1))
;;=> 1

See Also: