Examples
A time readout in packed decimal
Represent a decimal number using one four-bit nibble per digit. Leading zeroes are not retained in numeric input.
Input
123456Expected answer
0001 0010 0011 0100 0101 01100001 0010 0011 0100 0101 0110
- Scheme
8 4 2 1- Packed
On- Signed
Off- Output format
Nibbles
An inventory count
Represent a decimal number using one four-bit nibble per digit. Leading zeroes are not retained in numeric input.
Input
42Expected answer
0100 00100100 0010
- Scheme
8 4 2 1- Packed
On- Signed
Off- Output format
Nibbles
A zero-prefixed identifier
Represent a decimal number using one four-bit nibble per digit. Leading zeroes are not retained in numeric input.
Input
00123Expected answer
0001 0010 00110001 0010 0011
- Scheme
8 4 2 1- Packed
On- Signed
Off- Output format
Nibbles
An all-nine counter boundary
Represent a decimal number using one four-bit nibble per digit. Leading zeroes are not retained in numeric input.
Input
9999Expected answer
1001 1001 1001 10011001 1001 1001 1001
- Scheme
8 4 2 1- Packed
On- Signed
Off- Output format
Nibbles
A decimal price without the point
Represent a decimal number using one four-bit nibble per digit. Leading zeroes are not retained in numeric input.
Input
1299Expected answer
0001 0010 1001 10010001 0010 1001 1001
- Scheme
8 4 2 1- Packed
On- Signed
Off- Output format
Nibbles
default 0
Input
0Expected answer
00000000
- Scheme
8 4 2 1- Packed
On- Signed
Off- Output format
Nibbles
packed, signed bytes
Input
1234567890Expected answer
00000001 00100011 01000101 01100111 10001001 0000110000000001 00100011 01000101 01100111 10001001 00001100
- Scheme
8 4 2 1- Packed
On- Signed
On- Output format
Bytes
packed, signed nibbles, 8 4 -2 -1
Input
-1234567890Expected answer
0000 0111 0110 0101 0100 1011 1010 1001 1000 1111 0000 11010000 0111 0110 0101 0100 1011 1010 1001 1000 1111 0000 1101
- Scheme
8 4 -2 -1- Packed
On- Signed
On- Output format
Nibbles
unpacked nibbles
Input
1234567890Expected answer
0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 0111 0000 1000 0000 1001 0000 00000000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 0111 0000 1000 0000 1001 0000 0000
- Scheme
8 4 2 1- Packed
Off- Signed
Off- Output format
Nibbles
Format reference: To BCD background and specification