Back
log1p (clj)
(source)function
(log1p x)
Returns ln(1+x). For small values of x, log1p(x) is more accurate than
log(1.0+x).
If x is ##NaN or < -1 => ##NaN
If x is ##Inf => ##Inf
If x is -1 => ##-Inf
If x is 0 => 0 with sign matching x
See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#log1p-double-
Examples
clojure
(ns clojure.test-clojure.math
(:require
[clojure.test :refer :all]
[clojure.math :as m]))
(deftest test-log1p
(is (NaN? (m/log1p ##NaN)))
(is (= ##Inf (m/log1p ##Inf)))
(is (= ##-Inf (m/log1p -1.0)))
(is (pos-zero? (m/log1p 0.0)))
(is (neg-zero? (m/log1p -0.0))))