Back

tanh (clj)

(source)

function

(tanh x)
Returns the hyperbolic tangent of x, sinh(x)/cosh(x). If x is ##NaN => ##NaN If x is zero => zero, with same sign If x is ##Inf => +1.0 If x is ##-Inf => -1.0 See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#tanh-double-

Examples

clojure
(ns clojure.test-clojure.math
  (:require
    [clojure.test :refer :all]
    [clojure.math :as m]))

(deftest test-tanh
  (is (NaN? (m/tanh ##NaN)))
  (is (= 1.0 (m/tanh ##Inf)))
  (is (= -1.0 (m/tanh ##-Inf)))
  (is (= 0.0 (m/tanh 0.0))))