Description
Return byte = 16*tens+units, putting the decimal tens digit in the high nibble.
Packed binary-coded decimal assigns one decimal digit to each four-bit nibble and may reserve a trailing nibble for a sign. Sign conventions vary by format, so a digit pair and a signed decimal record are different encodings.
Return byte = 16*tens+units, putting the decimal tens digit in the high nibble.
When to use this tool
Use Encoding: Packed BCD Byte Digits when inspecting one packed-decimal digit or declared sign-nibble convention.
How to use the tool and how it works
- Enter tens, units. 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.
Require whole tens and units each in [0,9]. Return byte = 16*tens+units, putting the decimal tens digit in the high nibble.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| tens | Tens | Required. Safe integer. |
| units | Units | Required. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Object containing the named calculated members below. | Required. Object. |
| result.byte | Byte | Calculated result member: number. |
{
"input": {
"tens": 4,
"units": 2
},
"output": {
"result": {
"byte": 66
}
}
} Limitations and assumptions
- This is one unsigned packed BCD digit pair. It does not add a sign nibble, validate a larger record or encode binary decimal values through ordinary integer conversion.
- 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 format to establish digit count, sign policy, byte layout and compatibility.
References
Similar or alternative tools
- Packed BCD Positive Sign Nibble
Accept policy signed-preferred or unsigned.
- Encoding: Signed BCD Trailing Nibble
Return nibble 13 for negative, 12 for positive and 15 for unsigned.