Back

log (clj)

(source)

function

(log a)
Returns the natural logarithm (base e) of a. If a is ##NaN or negative => ##NaN If a is ##Inf => ##Inf If a is zero => ##-Inf See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#log-double-

Examples

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

(deftest test-log
  (is (NaN? (m/log ##NaN)))
  (is (NaN? (m/log -1.0)))
  (is (= ##Inf (m/log ##Inf)))
  (is (= ##-Inf (m/log 0.0)))
  (is (ulp= (m/log m/E) 1.0 1)))

(deftest test-log10
  (is (NaN? (m/log10 ##NaN)))
  (is (NaN? (m/log10 -1.0)))
  (is (= ##Inf (m/log10 ##Inf)))
  (is (= ##-Inf (m/log10 0.0)))
  (is (ulp= (m/log10 10) 1.0 1)))

(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))))
wedesoft/sfsim25
(require '[clojure.math :refer (sin cos PI sqrt exp log pow)]
         '[fastmath.vector :refer (vec3)]
         '[fastmath.matrix :refer (mulm)]
         '[sfsim25.render :refer :all]
         '[sfsim25.matrix :refer :all]
         '[sfsim25.worley :refer :all]
         '[sfsim25.shaders :as shaders]
         '[sfsim25.clouds :refer :all]
         '[sfsim25.util :refer :all])

(def alpha (atom 0))
(def beta (atom 0))
(def threshold (atom 0.4))
(def multiplier (atom 4.0))
(def curl-scale-exp (atom (log 4)))
(def cloud-scale-exp (atom (log 2)))
(def prevailing (atom 0.1))
(def whirl (atom 1.0))