Handling floating values, miscellaneous coercions.
Handling floating values, miscellaneous coercions.
(= x-1 x-2)
Tests for equality between 2 floats where ##NaN
is equal to itself (unlike regular =
or ==
).
Tests for equality between 2 floats where `##NaN` is equal to itself (unlike regular `=` or `==`).
(b64 f64)
Converts a 64-bit float to a 64-bit integer preserving the bit pattern.
Opposite of from-b64
.
(def bits
(b64 42.24))
;; equals 4631166901565532406
(= 42.24
(from-b64 bits))
Useful for places which can handle integers but not floats.
Converts a 64-bit float to a 64-bit integer preserving the bit pattern. Opposite of [[from-b64]]. ```clojure (def bits (b64 42.24)) ;; equals 4631166901565532406 (= 42.24 (from-b64 bits)) ``` Useful for places which can handle integers but not floats.
(f32 x)
Coerce x
to a 32-bit float.
In JS, there are no 32-bit floats. Hence, the returned value is a 32-bit representation embedded in a 64-bit number.
Coerce `x` to a 32-bit float. In JS, there are no 32-bit floats. Hence, the returned value is a 32-bit representation embedded in a 64-bit number.
(from-b32 b32)
Interprets bits from a 32-bit integer as a 32-bit float.
Opposite of b32
.
Interprets bits from a 32-bit integer as a 32-bit float. Opposite of [[b32]].
(from-b64 b64)
Interprets bits from a 64-bits integer as a 64-bit float.
Opposite of b64
.
Interprets bits from a 64-bits integer as a 64-bit float. Opposite of [[b64]].
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close