Liking cljdoc? Tell your friends :D

helins.binf.float

Handling floating values, miscellaneous coercions.

Handling floating values, miscellaneous coercions.
raw docstring

=clj/s

(= 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 `==`).
sourceraw docstring

b32clj/s

(b32 f32)

Converts a 32-bit float to a 32-bit integer preserving the bit pattern.

Opposite of from-b32.

See b64 for an example.

Converts a 32-bit float to a 32-bit integer preserving the bit pattern.

Opposite of [[from-b32]].

See [[b64]] for an example.
sourceraw docstring

b64clj/s

(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.
sourceraw docstring

f32clj/s

(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.
sourceraw docstring

f64clj/s

(f64 x)

Coerce x to a 64-bit float.

Coerce `x` to a 64-bit float.
sourceraw docstring

from-b32clj/s

(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]].
sourceraw docstring

from-b64clj/s

(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]].
sourceraw docstring

nan?clj/s

(nan? x)

Returns true if x is ##NaN.

Returns true if `x` is `##NaN`.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close