Description
Decode one packed BCD byte into two digits and a decimal value.
Packed binary-coded decimal places decimal digits and sometimes a sign in separate nibbles. Decoding a digit pair differs from interpreting a trailing sign convention or a complete signed field.
Decode one packed BCD byte into two digits and a decimal value.
When to use this tool
Use Decoding: Packed BCD Byte Digits when inspecting a supported packed-decimal nibble or byte.
How to use the tool and how it works
- Enter byte. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read result. Expand result to inspect the returned fields.
Decode one packed BCD byte into two digits and a decimal value. Require whole byte in [0,255] and both nibbles <= 9; tens = floor(byte/16), units = byte modulo 16, decimalValue = 10*tens+units.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| byte | One numeric octet, from 0 through 255. | Required. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Returned object; expand its named members below. | Required. Object. |
| result.tens | Tens | Calculated result member: number. |
| result.units | Units | Calculated result member: number. |
| result.decimalValue | Decimal Value | Calculated result member: number. |
{
"input": {
"byte": 66
},
"output": {
"result": {
"tens": 4,
"units": 2,
"decimalValue": 42
}
}
} Limitations and assumptions
- Sign nibbles are rejected; this is not whole-field signed decimal decoding.
- Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Use the complete record layout to establish precision, sign policy, byte order and representation validity.
References
Similar or alternative tools
- Protocol Buffers Fixed32 Byte Order Field
Decode four little-endian octet fields to an unsigned value.
- Msgpack Fixstr Byte Count
Return the byte length encoded by a fixstr header.