Back
sin (clj)
(source)function
(sin a)
Returns the sine of an angle.
If a is ##NaN, ##-Inf, ##Inf => ##NaN
If a is zero => zero with the same sign as a
See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#sin-double-
Examples
clojure
(ns clojure.test-clojure.math
(:require
[clojure.test :refer :all]
[clojure.math :as m]))
(deftest test-sin
(is (NaN? (m/sin ##NaN)))
(is (NaN? (m/sin ##-Inf)))
(is (NaN? (m/sin ##Inf)))
(is (pos-zero? (m/sin 0.0)))
(is (neg-zero? (m/sin -0.0)))
(is (ulp= (m/sin m/PI) (- (m/sin (- m/PI))) 1)))
(deftest test-asin
(is (NaN? (m/asin ##NaN)))
(is (NaN? (m/asin 2.0)))
(is (NaN? (m/asin -2.0)))
(is (zero? (m/asin -0.0))))
(deftest test-sinh
(is (NaN? (m/sinh ##NaN)))
(is (= ##Inf (m/sinh ##Inf)))
(is (= ##-Inf (m/sinh ##-Inf)))
(is (= 0.0 (m/sinh 0.0))))