getF64Codec
Returns a codec for encoding and decoding 64-bit floating-point numbers (f64).
This codec serializes f64 values using 8 bytes.
Due to the IEEE 754 floating-point representation, some precision loss may occur.
Parameters
| Parameter | Type | Description |
|---|---|---|
config | NumberCodecConfig | Optional configuration to specify endianness (little by default). |
Returns
FixedSizeCodec<number | bigint, number, 8>
A FixedSizeCodec<number, number, 8> for encoding and decoding f64 values.
Examples
Encoding and decoding an f64 value.
Using big-endian encoding.
Remarks
f64 values follow the IEEE 754 double-precision floating-point standard.
Precision loss may still occur but is significantly lower than f32.
- If you need smaller floating-point values, consider using getF32Codec.
- If you need integer values, consider using getI64Codec or getU64Codec.
Separate getF64Encoder and getF64Decoder functions are available.