Description
Accept policy signed-preferred or unsigned.
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.
Accept policy signed-preferred or unsigned.
When to use this tool
Use Packed BCD Positive Sign Nibble when inspecting one packed-decimal digit or declared sign-nibble convention.
How to use the tool and how it works
- Enter policy. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read nibble, hex. Use the output convention below.
Accept policy signed-preferred or unsigned. Return nibble and lowercase hex as 12/c for signed-preferred and 15/f for unsigned.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| policy | Policy | Required. Text; one of "signed-preferred", "unsigned"; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| nibble | Nibble | Required. Safe integer. |
| hex | Hex | Required. Text; maximum UTF-16 length 8192. |
{
"input": {
"policy": "signed-preferred"
},
"output": {
"nibble": 12,
"hex": "c"
}
} Limitations and assumptions
- This selects one positive packed-decimal sign convention, not a whole BCD value or a guarantee of compatibility with another decimal format.
- 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.
Alternative or Complementary methods
Use the complete record format to establish digit count, sign policy, byte layout and compatibility.
References
Similar or alternative tools
- Encoding: Packed BCD Byte Digits
Return byte = 16*tens+units, putting the decimal tens digit in the high nibble.
- Encoding: Signed BCD Trailing Nibble
Return nibble 13 for negative, 12 for positive and 15 for unsigned.