Back

next-down (clj)

(source)

function

(next-down d)
Returns the adjacent double of d in the direction of ##-Inf. If d is ##NaN => ##NaN If d is ##-Inf => ##-Inf If d is zero => -Double/MIN_VALUE See: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextDown-double-

Examples

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

(deftest test-next-down
  (is (NaN? (m/next-down ##NaN)))
  (is (= ##-Inf (m/next-down ##-Inf)))
  (is (= (- Double/MIN_VALUE) (m/next-down 0.0))))