Skip to content

Main content

Decoding: Packed BCD Byte Digits Tool

Decode exactly two packed-BCD decimal digits in one unsigned byte, rejecting either nibble above9; no signed trailing nibble or full decimal field.

Loading tool…

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

  1. Enter byte. 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.

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 fieldMeaning and unitsAccepted input
byteOne numeric octet, from 0 through 255.Required. Safe integer.
Output fieldInterpretationReturned shape
resultReturned object; expand its named members below.Required. Object.
result.tensTensCalculated result member: number.
result.unitsUnitsCalculated result member: number.
result.decimalValueDecimal ValueCalculated result member: number.
json
{
  "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

  1. Calculation and input contract: decode/packed-bcd-byte-digits — tool.io

Similar or alternative tools