Densely packed decimal declets #
The eight cases below are Cowlishaw's DPD encoding table, also specified by IEEE 754-2019 ยง3.5.2(c)(1). Three decimal digits occupy ten bits. Decoding accepts all 1024 bit patterns; the 24 redundant patterns select the same digits as their canonical encodings.
Source: https://speleotrove.com/decimal/DPDecimal.html, encoding and decoding tables.
Encode three decimal digits. The input contract is n < 1000.
Instances For
Decode a ten-bit declet, including its redundant encodings.