SofaBuffers TypeScript - v0.12.0
    Preparing search index...

    Function floatArrayBitsEqual

    • Bit-pattern equality for two float arrays: same length, and at every index the same IEEE-754 bits. +0 and -0 differ; a NaN equals another NaN only if the bits are identical; there is no === verdict on its own.

      Both element widths give the same verdict here. An fp32 is held as a double in this port, so the bits compared are those of the held double — and widening a float32 to a double is injective on bit patterns, so that is the same verdict as comparing the 32-bit patterns. The signaling-NaN raw-bytes path (fp32RawBytes) is separate and untouched.

      The NaN payload comparison is only as exact as the container: a plain number[] may canonicalise a NaN when it is stored (V8 does, to keep its hole pattern free), so payloads are only distinguishable in a Float64Array / Float32Array; for a plain array every NaN of one sign compares equal. The comparison itself reads each element once and computes nothing on it.

      Accepts number[], typed arrays and a literal default alike. No allocation per call, no mutation, no identity short-circuit (x against x gives the same answer as against a copy).

      Parameters

      • a: ArrayLike<number>
      • b: ArrayLike<number>

      Returns boolean