Binary-coded decimal: Difference between revisions

Content deleted Content added
m Advantages: formatting fixes
Line 752:
* [[Rounding]] at a decimal digit boundary is simpler. Addition and subtraction in decimal do not require rounding.{{dubious|Rounding|date=November 2021}}
* The alignment of two decimal numbers (for example 1.3 + 27.08) is a simple, exact shift.
* Conversion to a character form or for display (e.g., to a text-based format such as [[XML]], or to drive signals for a [[seven-segment display]]) is a simple per-digit mapping, and can be done in linear ([[Big-O notation|O]](''n'')) time. Conversion from pure [[binary numeral systemnumber|binary]] involves relatively complex logic that spans digits, and for large numbers, no linear-time conversion algorithm is known (see {{see section|Binary numeral systemnumber|Conversion to and from other numeral systems}}).
* Many non-integral values, such as decimal 0.2, have an infinite place-value representation in binary (.001100110011...) but have a finite place-value in binary-coded decimal (0.0010). Consequently, a system based on binary-coded decimal representations of decimal fractions avoids errors representing and calculating such values. This is useful in financial calculations.
 
=== Disadvantages ===