BinaryFormat.Single
BinaryA binary format that reads a 4-byte IEEE single-precision floating point value.
Syntax
BinaryFormat.Single(binary as binary) as anyParameters
| Name | Type | Required | Description |
|---|---|---|---|
binary | binary | Yes | The binary data to read the 4-byte single-precision floating point value from. |
Return Value
function — A binary format function that reads a 4-byte IEEE 754 single-precision floating point value from binary data.
Remarks
BinaryFormat.Single is a binary format specifier that reads a 4-byte (32-bit) IEEE 754 single-precision floating point value from binary data. Single-precision floats provide approximately 6-9 significant decimal digits of precision and can represent values in the range of approximately +/-1.5 x 10^-45 to +/-3.4 x 10^38.
The default byte order is little-endian. Use BinaryFormat.ByteOrder to change the byte order if the source data uses big-endian encoding.
For higher precision, consider using BinaryFormat.Double (8 bytes, ~15-17 significant digits) or BinaryFormat.Decimal (16 bytes, 28-29 significant digits).
Examples
Example 1: Read a single-precision floating point value
let
// IEEE 754 single-precision representation of 1.0 (little-endian)
binaryData = #binary({0x00, 0x00, 0x80, 0x3F}),
result = BinaryFormat.Single(binaryData)
in
result