# Hardware Design for Decimal Multiplication

Mário P. Véstias (INESC-ID/ISEL/IPL, Portugal) and Horácio C. Neto (INESC-ID, Instituto Superior Técnico, Universidade de Lisboa, Portugal)
DOI: 10.4018/978-1-4666-5888-2.ch538

Top

## Background

Usually, humans perform arithmetic operations by hand using decimal arithmetic. However, most computers do it with binary arithmetic. It means that performing decimal operations in a computer without support for decimal arithmetic is subject to errors from representing decimal numbers, converting them and rounding. In fact, it is easy find decimal numbers that cannot be represented exactly in binary format (e.g., 0.1). Several examples exist where errors due to binary calculation of decimal numbers are obtained. A clarifying example came from the Vancouver Stock Exchange (Quinn, 1983), where due to rounding errors an initial index value of 1000.000 dropped to 574.081 instead of the correct result of 1098.892.

In fact, the business and commercial markets were one of the triggers for the importance of decimal computer arithmetic since many commercial databases have more than 50% of the numerical data represented in decimal (Tsang & Olschanowsky, 1991). In these cases, to avoid errors with undesirable consequences it is important to have a complete system to support decimal arithmetic.

At the era of electronic computers, both binary and decimal arithmetic functions were considered. We had computer systems, like the ENIAC (Goldstine & Goldstine, 1996) and IBM 650 (Knuth, 1986) implementing arithmetic functions in decimal, and others like EDSAC (Wilkes, 1997) and EDVAC (Williams, 1993) that adopted binary based arithmetic implementations. Both arithmetic systems were still considered after the advent of transistorized computers with decimal numbers represented with four bits following different representations, like in Binary-Coded Decimal (BCD) format. However, soon binary arithmetic was adopted by most computer systems since at that time scientific computing, whose operations could be more efficiently implemented in binary, were more in demand than financial computing that requires decimal arithmetic to avoid costs from representation errors. So, binary became very popular, while decimal was supported only by some computers in the 1960s and 1970s.

Precise decimal arithmetic operations with binary based computing systems are done with software. In some cases, these binary-based computing systems include some specific hardware instructions that are hardware supported and so software algorithms can take advantage of them to speed-up execution. Several languages include primate decimal datatypes, including Ada, COBOL, and SQL. Several other languages support the GDAS (General Decimal Arithmetic Specification) (Cowlishaw, 2008), including the IBM C DecNumber Library (Cowlishaw), the Java BigDecimal (Sun Microsystems), Eiffel Decimal Arithmetic (Crismer), Python Decimal (Batista), among others. Decimal floating point extensions conforming to the IEEE 754-2008 standard were proposed for C (JTC 1, 2007) and C++ (JTC 1, 2008) languages. These extensions were supported by GNU C compiler 4.2 release. Intel has also developed a decimal floating-point math library (Intel) that implements decimal floating-point arithmetic specified in IEEE 754-2008.

## Key Terms in this Chapter

Parallel Decimal Multiplication: A decimal multiplication method where partial products are generated and added according to a parallel process.

Decimal Floating-Point Multiplication: Refers to the multiplication operation where the inputs are represented in radix ten real numbers.

Decimal Multiplication: Refers to the multiplication operation where the operands are represented with some decimal digit encoding.

Decimal Fixed-Point Multiplication: Refers to the multiplication operation where the inputs are represented in radix ten fixed-point numbers.

Iterative Decimal Multiplication: A decimal multiplication method where partial products are generated and accumulated step-by-step in an iterative process.

Binary-Coded Decimal: A binary code of decimal numbers where each digit is represented with four bits.

Densely Packed Decimal: An encoding scheme in which three BCD digits are represented with ten bits.

## Complete Chapter List

Search this Book:
Reset