Java Reference
In-Depth Information
UNPACKED BCD
PACKED BCD
2
23
00000010
00100011
3
79
00000011
01111001
7
00000111
9
00001001
Figure 20-4 Packed and Unpacked BCD
The advantage of BCD representations is that the precision of the cal-
culations is not limited by a pre-defined encoding. A programmer can de-
velop a BCD format for representing any number of digits, to any decimal
precision. The main disadvantage of BCD mathematics is their much
slower speed of execution and the greater difficulty in developing mathe-
matical software.
The java.math library uses BCD and provides simple arithmetic to un-
limitedprecision.Thejava.mathlibraryisdiscussedin Chapter21 .
 
Search WWH ::




Custom Search