(ns same.klipse (:require-macros [same :refer [with-comparator]]) (:require [same :refer [ish? zeroish? not-zeroish? set-comparator!]] [same.compare :refer [compare-ulp]] [same.ish :refer [default-comparator]]))

Click here to make these examples interactive with ClojureScript.

same.platform

Platform-specific code, to try to minimise reader conditionals in the rest of the codebase.

bit-diff-double

(bit-diff-double f1 f2)

Difference between two doubles in ULPs (i.e. number of representable numbers between them + 1).

bit-diff-float

(bit-diff-float f1 f2)

Difference between two floats in ULPs (i.e. number of representable numbers between them + 1).

is-array?

(is-array? a)

Return true if a is an array.

is-infinite?

(is-infinite? f)

Return true if f is infinite.

max-value

FIXME: write docs

nan?

(nan? f)

Return true if f is NaN (Not-a-Number)

sign

(sign f)

Return the sign of f (+1 if positive, -1 if negative, 0 if zero or NaN if NaN).

to-float

(to-float f)

Round f to a single precision (32-bit) float.

ulp

(ulp f)

Units in the Last Place (ULP) of f (difference between f and the next largest representable number).