BinaryFormat.SignedInteger16

Binary

A binary format that reads a 16-bit signed integer.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

BinaryFormat.SignedInteger16(binary as binary) as any

Parameters

NameTypeRequiredDescription
binarybinaryYesThe binary data to read the 16-bit signed integer from.

Return Value

functionA binary format function that reads a 2-byte signed integer from binary data.

Remarks

BinaryFormat.SignedInteger16 is a binary format specifier that reads a 16-bit (2-byte) signed integer from binary data. The value range is -32768 to 32767 (Int16 / short). The integer is stored in two's complement format.

The default byte order is little-endian. Use BinaryFormat.ByteOrder to wrap this format if the source data uses big-endian byte ordering.

This format is commonly used in audio file headers (e.g., WAV files), image metadata, and network protocols that use 16-bit signed values.

Examples

Example 1: Read a 16-bit signed integer

let
    binaryData = #binary({0x01, 0x00}),
    result = BinaryFormat.SignedInteger16(binaryData)
in
    result

Example 2: Read a negative 16-bit signed integer

let
    // -1 in 16-bit two's complement little-endian = 0xFF, 0xFF
    binaryData = #binary({0xFF, 0xFF}),
    result = BinaryFormat.SignedInteger16(binaryData)
in
    result

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks