Description
Return nibble 13 for negative, 12 for positive and 15 for 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.
Return nibble 13 for negative, 12 for positive and 15 for unsigned.
When to use this tool
Use Encoding: Signed BCD Trailing Nibble when inspecting one packed-decimal digit or declared sign-nibble convention.
How to use the tool and how it works
- Enter sign, convention. 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 convention exactly canonical-CDF and sign negative, positive or unsigned. Return nibble 13 for negative, 12 for positive and 15 for unsigned.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| sign | Sign | Required. Text; one of "negative", "positive", "unsigned". Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units. |
| convention | Convention | Required. Text; one of "canonical-CDF". Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Object containing the named calculated members below. | Required. Object. |
| result.nibble | Nibble | Calculated result member: number. |
{
"input": {
"sign": "negative",
"convention": "canonical-CDF"
},
"output": {
"result": {
"nibble": 13
}
}
} Limitations and assumptions
- The numeric nibble is only the trailing sign field under the stated convention. Other packed-decimal sign policies and complete record layouts are not inferred.
- 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.
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: Packed BCD Byte Digits
Return byte = 16*tens+units, putting the decimal tens digit in the high nibble.