Back
cbrt (clj)
(source)function
(cbrt a)
Returns the cube root of a.
If a is ##NaN => ##NaN
If a is ##Inf or ##-Inf => a
If a is zero => zero with sign matching a
See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#cbrt-double-
Examples
clojure
(ns clojure.test-clojure.math
(:require
[clojure.test :refer :all]
[clojure.math :as m]))
(deftest test-cbrt
(is (NaN? (m/cbrt ##NaN)))
(is (= ##-Inf (m/cbrt ##-Inf)))
(is (= ##Inf (m/cbrt ##Inf)))
(is (pos-zero? (m/cbrt 0)))
(is (= 2.0 (m/cbrt 8.0))))