Kit
Variables

getF32Decoder

const getF32Decoder: (config?) => FixedSizeDecoder<number, 4>

Returns a decoder for 32-bit floating-point numbers (f32).

This decoder deserializes f32 values from 4 bytes. Some precision may be lost during decoding due to floating-point representation.

For more details, see getF32Codec.

Parameters

ParameterTypeDescription
config?NumberCodecConfigOptional configuration to specify endianness (little by default).

Returns

FixedSizeDecoder<number, 4>

A FixedSizeDecoder<number, 4> for decoding f32 values.

Example

Decoding an f32 value.

const decoder = getF32Decoder();
const value = decoder.decode(new Uint8Array([0x00, 0x00, 0xc0, 0xbf])); // -1.5

See

getF32Codec

On this page