Back
expm1 (clj)
(source)function
(expm1 x)
Returns e^x - 1. Near 0, expm1(x)+1 is more accurate to e^x than exp(x).
If x is ##NaN => ##NaN
If x is ##Inf => #Inf
If x is ##-Inf => -1.0
If x is zero => x
See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#expm1-double-
Examples
clojure
(ns clojure.test-clojure.math
(:require
[clojure.test :refer :all]
[clojure.math :as m]))
(deftest test-expm1
(is (NaN? (m/expm1 ##NaN)))
(is (= ##Inf (m/expm1 ##Inf)))
(is (= -1.0 (m/expm1 ##-Inf)))
(is (= 0.0 (m/expm1 0.0))))