Skip to content

Main content

Encoding: Signed BCD Trailing Nibble Tool

Encode one canonical C-positive/D-negative/F-unsigned packed-decimal sign nibble under an explicit restricted convention; no complete decimal field.

Loading tool…

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

  1. Enter sign, convention. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. 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 fieldMeaning and unitsAccepted input
signSignRequired. Text; one of "negative", "positive", "unsigned". Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units.
conventionConventionRequired. Text; one of "canonical-CDF". Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units.
Output fieldInterpretationReturned shape
resultObject containing the named calculated members below.Required. Object.
result.nibbleNibbleCalculated result member: number.
json
{
  "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

  1. Calculation and input contract: encode/signed-bcd-trailing-nibble — tool.io

Similar or alternative tools