Sie sind auf Seite 1von 4

2011 Fourth International Conference on Information and Computing

An Introduction to Complex Binary Number System

Tariq Jamil
Department of Electrical and Computer Engineering
Sultan Qaboos University
AlKhod 123, OMAN
tjamil@squ.edu.om

AbstractThe vital role of complex numbers in various providing a division algorithm and considered it as a main
electrical and computer engineering applications demands obstacle towards hardware implementation of any imaginary
formulation of an efficient method for their representation and base number system. Walter Penny, in 1964, attempted to
processing in the central processing unit of a microprocessor. define a complex number system, first by using a negative
Complex Binary Number System (CBNS) allows both real and base of 4 [2] and then by using a complex number (1+j) as
imaginary parts of a complex number to be represented as a the base[3]. As before, the main problem encountered with
single unit (instead of two separate units as in todays using these unusual bases was the inability to formulate an
microprocessors), thus allowing for faster arithmetic efficient division process. Stepanenko, in 1996, utilized the
operations of complex numbers and increase in overall system
performance. In this paper, an introduction to CBNS has been
base j2 in which the even powers of the base yield real
presented and various algorithms for its arithmetic operations numbers and the odd powers of the base result in imaginary
have been outlined. Information about adder, subtractor, numbers[4]. Although partly successful in resolving the
multiplier, and divider circuits for CBNS has been provided division problem as an all-in-one operation, in his
and avenues of future research in this arena have been algorithm, everythingreduces to good choice of an
identified. initial approximation in a Newton-Raphson iteration
which may or may not converge. Since 2000, Jamil et. al.
Keywords-complex binary number; conversion algorithms; have revived the idea of a (1+j)-base complex binary
arithmetic; addition; subtraction; multiplication; division. number system (CBNS) and have presented a detailed
analysis of arithmetic algorithms involving these numbers
I. INTRODUCTION [5,6].
This paper is organized as follows: In Section II,
Complex numbers play pivotal role in various electrical algorithms to convert a given complex number into (1+j)-
and computer engineering applications. To represent these base complex binary number system representation will be
numbers, for storage in memory or to process these numbers outlined with some examples. This will be followed with the
for various arithmetic operations within the Arithmetic and presentation of addition, subtraction, multiplication, and
Logic Unit (ALU) of a Central Processing Unit (CPU), a division algorithms in Sections III. In Section IV,
technique called divide-and-conquer is used wherein the information about the hardware implementations of various
complex number is broken into its real and imaginary parts arithmetic circuits has been given. Finally, conclusion and
and then arithmetic operations are carried out on each part, avenues of future research in CBNS will be presented in
independent of any knowledge about its twin real or Section V. Acknowledgment and References have been
imaginary part in the complex number. Thus, addition of two listed at the end of the paper.
complex numbers, (a+jb) and (c+jd), involves two separate
additions, (a+c) and (b+d), one for the real parts and one for II. CBNS CONVERSION ALGORITHMS
the imaginary parts. Similarly the multiplication of the same
two complex numbers requires four individual A. Conversion algorithm for integers
multiplications (ac, ad, bc, bd), one addition (ac+j(ad+bc)) To represent positive integer N in CBNS, we follow the
and one subtraction (j2bd = bd). The number of nested
following steps: (i) Express N in terms of power of 4 using
arithmetic operations within the complex numbers addition
division process. (ii) Convert the base 4 number
and multiplication can be effectively reduced to just one
addition and one multiplication for the given cases if we are (q5,q4,q3,q2,q1,q0) to base 4 by replacing each digit in
able to represent each complex number (both real and odd location (q1,q3,q5,) with its negative to get
imaginary parts) as a single entity instead of as two separate (,q5,q4, q3,q2, q1,q0). (iii) Normalize the new
numbers. number (i.e., get each digit in the range 0 to 3) by repeatedly
Efforts in providing one-unit representation to complex adding 4 to the negative digits and adding a 1 to the digit on
numbers date back to 1960 when Donald E. Knuth described its left. If the digit is 4, replace it by a zero and subtract a
a quater-imaginary number system with base 2j and one from the digit on its left. (iv) Now replace each digit in
analyzed the arithmetic operations of numbers using this base 4 representation with the corresponding four-bit
imaginary base[1]. However he was unsuccessful in sequence (0 o0000; 1o 0001; 2o 1100; 3o 1101).

978-0-7695-4378-9/11 $26.00 2011 IEEE 229


DOI 10.1109/ICIC.2011.37
As an example, f3 = 1, r3 = 2r2 -1 = 2(0.75) 1 = 0.5
2005base10 = (1,3,3,1,1,1)base 4 = (1, 3, 3, 1, 1,1)base 4 2r3 1 = 2(0.5) 1 = 0 (STOP)
= (1,3,4,1,2,3,1)base 4 = (1,2,0,1,2,3,1)base 4 (normalized) f4= 1, r4 = 0
= 0001 1100 0000 0001 1100 1101 0001 base 1+j Thus
= 1110000000001110011010001 base 1+j 0.4375base 10 = 0.2-1 + 1. 2-2 + 1. 2-3 + 1. 2-4
To convert a negative integer into (1+j)-base = 0(1.11) + 1(1.1101) + 1(0.000011) + 1(0.00000001)
representation, we simply multiply the representation of the = 1.11011101base -1+j
corresponding positive integer with 11101 (equivalent to (addition according to the algorithm given in Section III)
1base 1+j) according to the multiplication algorithm given in
Section III. Thus It is likely that most fractions will not terminate as our
2005base10 example, until the machine limit is reached. For example,
= (0001 1100 0000 0001 1100 1101 0001) x (11101) 0.351base 10 =1.110111001100110000011100110base(-1+j)
= 1100 0000 0000 1101 1100 1101 base 1+j In that case, it is up to the user to terminate the process
B. Conversion algorithm for imaginary numbers when certain degree of accuracy has been achieved.
To obtain binary representation of a given positive or D. Conversion algorithm for floating point numbers
negative imaginary number in CBNS, we simply multiply To represent a floating point positive number in the new
(according to the multiplication algorithm given in Section base, we add the integer and fractional representations
III) the corresponding (1+j)-base representation of positive according to the addition algorithm given in Section III.
or negative integer with 11 (equivalent to jbase 10) or 111 Once again, all rules for obtaining negative integer and
(equivalent to jbase 10), as required. Thus, given positive/negative imaginary number representations in base
2005base10 = 1110000000001110011010001 base 1+j then (1+j), as discussed previously, are equally applicable for
j2005base10= (1110000000001110011010001) x (11) obtaining negative floating point and positive/negative
= 10000000011001101110011 base 1+j imaginary floating point representations in the proposed
And new base. For example
j2005base10= (1110000000001110011010001) x (111) 2005.4375base 10
= 111010000000111011100110111 base 1+j = 1110000000001110011010001 + 1.11011101
C. Conversion algorithm for fractions = 1110000000001110011011100.11011101base 1+j
And
The procedure for finding the binary equivalent for j2005.4375base 10
fractions in base (1+j) is based on the usual approach to = 1110000000001110011011100.11011101 x 11
obtaining ordinary binary representations. Any fraction F = 10000000011001101110011.01000111base 1+j
can be expressed uniquely in terms of powers of = 21 Having known the conversion algorithms, the binary
such that F = r0 = f1. 21 + f2. 22 + f3. 23 + f4. 24+ to representation for any given complex number can be easily
machine limit. Then the coefficients fi and the remainders ri obtained, as shown by the following example:
are given as follows:
Initially (2005.4375 + j2005.4375)base10
if 2r0 1 < 0 then f1 = 0 and set r1 = 2r0 = 1110000000001110011011100.11011101base (1+j)
or if 2r0 1 t 0 then f1 = 1 and set r1 = 2r0 1 + 10000000011001101110011.01000111base (1+j)
Then = 1110100000001110111001101000.10000110base(-1+j)
if 2ri 1 < 0 then fi+1 = 0 and ri+1 = 2ri
III. CBNS ARITHMETIC ALGORITHMS
or if 2ri 1 t 0 then fi+1 = 1 and ri+1 = 2ri 1
We continue this process until ri = 0 or the machine limit A. Addition Algortihm
has been reached. Then, for fi = 1, we replace its
The binary addition of two complex binary numbers
associated 2-i according to the sequence (21o 1.11, follows these rules: 0 + 0 = 0;0 + 1 = 1; 1 + 0 = 1; 1 + 1 =
22o1.1101, 23o0.000011, 24o 0.00000001) [for i > 4, 1100. These rules are very similar to the traditional binary
refer to [7]). arithmetic except for the last case when two numbers with
As an example, let F = r0 = 0.4375base10 1s in position n are added, this will result in 1s in positions
Initially n+3 and n+2 and 0s in positions n+1 and n in the sum.
2r0 1 = 2(0.4375) 1 = 0.125 < 0 Similar to the ordinary computer rule where 1+111 (to
f1 = 0, r1 = 2r0 = 2(0.4375) = 0.875 limit of machine) =0, we have 11 + 111 = 0 [Zero Rule].
Then
2r1 1 = 2(0.875) 1 = 0.75 > 0 B. Subtraction Algorithm
f2 = 1, r2 = 2r11 = 2(0.875) 1 = 0.75 The subtraction of two complex binary numbers follows
Continuing according to the algorithm, we have these rules: 0 0 = 0 ; 0 1 = * ; 1 0 = 1 ; 1 1 = 0. Three
2r2 1 = 2(0.75) 1 = 0.5 > 0 of the four conditions listed in these rules are the same as for

230
subtraction in ordinary base 2 number system. For the case with our initial approximation of z setting z0 = (1+j)-k
where 1 is subtracted from 0 (the * case in the rules), the where k is obtained from the representation of w such that
following algorithm applies: k
Assuming our minuend is:
w   ai (1+j)-i (1)
anan-1an-2ak+4ak+3ak+2ak+1ak0ak-1a3a2a1a0
and subtrahend is: i = 
bnbn-1bn-2bk+4bk+3bk+2bk+11bk-1b3b2b1b0 in which ak  1 and ai  0 for i > k. The successive
Then, the result of subtracting 1 from 0 is obtained by approximations are then obtained by zi+1 = zi (2 wzi). If the
changing ak  ak + 1; ak+1 ak+1 (unchanged); ak+2 ak+2 + values of z do not converge, we correct our initial
1; ak+3 ak+3 + 1; ak+4 ak+4 + 1; and bk 0. As an example, approximation to z0 = j(1 + j)-k which will definitely
lets solve: 2 (1+j3) = 1100 1010 = 0100 0010 = converge. Having calculated the value of z, we just multiply
111110 000000 (by algorithm) = 111110 = (1j3) it with (a+jb) to obtain the result of the division. In the
following examples, for the sake of clarity, decimal
C. Multiplication Algorithm
numbers have been used to explain the converging process
The multiplication process of two complex binary of the division algorithm. Let (a + jb) = 1 + j2, and w = 1 +
numbers is similar to multiplying two ordinary binary j3. Our calculations for approximation of z = w-1 then begin
numbers. However, while adding the intermediate results of as follows:
multiplication, the rules given previously for adding complex 1 + j3 = 1010base -1+j = 1.(1 + j)3 + 0.(1+j)2 + 1.(1 + j)1 +
numbers should be followed. The zero rule plays an
important role in reducing the number of summands 0.(1+j)0 k = 3
resulting from intermediate multiplications. As an example, Therefore,
lets multiply (2j)(1+j2). z0=(1+j)3 = 0.25j0.25
z1 = 0.125j0.375
2 j = 2 + (j) = 1100 + 111 = 111011base -1+j z2 = 0.09375j0.28125,
1 + 2j = 0001 + 1110100 = 1110101base -1+j z3 = 0.099609375j0.2988281250
Now (2 j)(1 + 2j) = 111011base 1+j x 1110101base-1+j z4 = 0.09999847412j0.2999954224
The multiplication of two complex binary numbers is shown z5 = 0.1j0.3
in Fig.1, wherein bold-faced 1s help us in recognizing the z6 = 0.1j0.3 (converging).
pattern 111 + 11 which results in 0 (zero rule). Now,
0.1j0.3 = 0.001111001011110010111100...base -1+j
1110101 So (1+j2) (1+j3)
111011 = (1+j2) x (1+j3)-1
==================== = 1110101 base -1+j x0.001111001011110010111100...base -1+j
1110101 = 1.11111001011110010111100101111...base -1+j
1110101 = 0.7j0.1
0000000 As another example, let w = 28j15, then
1110101 28j15 = 11011010011base -1+j
1110101 = 1.(1+j) 10+1.(1+j) 9+0.(1+j) 8+1.(1+j)7+1.(1+j)6+
1110101 0.(1+j)5+1.(1+j)4+0.(1+j)3+0.(1+j)2+1.(1+j)1+
==================== 1.(1+j)0
000001000111 k = 10
11 We begin by choosing z0 = (1+j)10 = j0.03125
11 z1 := 0.02734375+j0.0478515625
11 z2 := 0.05861282347j0.0007009506465
==================== z3 := 0.02227897905+j0.05242341786
1100111 z4 := 0.07257188256+j0.005664255473
z5 := 0.01375684714+j0.06682774792
Figure 1. Multiplication of two complex binary numbers z6 := 0.1198139965+j0.1209880304
z7 := 0.1873379177j0.5740439146
z8 := 4.643184188j11.58680236
D. Division Algorithm z9 := 4778.731320+j1299.184773 (not converging)
So we correct our initial approximation to:
The division algorithm is based on determining the
z0 = j(1+j)-10 = 0.03125
reciprocal of the divisor (denominator) and then multiplying
z1:= (0.03515625+j0.0146484375
it with the dividend (numerator) according to the
z2:=(0.02626419066+j0.01577854156
multiplication algorithm[8]. Thus (a+jb) (c+jd) =
z3:=(0.02775239316+j0.01496276824
(a+jb)(c+jd)-1 = (a+jb)z where z = w-1 and w = c+jd. We start
z4:=(0.02775050252+j0.01486605276

231
z5:=(0.02775024777+j0.01486620416 author in July 2010 and efforts are continuing towards
z6:=(0.02775024777+j0.01486620416 commercial implementation of this number system for
z7:=(0.02775024777+j0.01486620416 various engineering applications.
z8:=(0.02775024777+j0.01486620416
z9:=(0.02775024777+j0.01486620416 (converging)
ACKNOWLEDGMENT
The converging value of z9 can be represented in base
(1+j). It can then be multiplied with any given complex The author gratefully acknowledges the financial support
number to obtain the result of dividing the given complex provided by Sultan Qaboos University (Oman) for the
number by 28 j15, as in the previous example. CBNS-related projects through various research grants. The
technical collaboration of Neville Holmes, David Blest,
IV. CBNS ARITHMETIC CIRCUITS Bassel Arafeh, Amer Al-Habsi, Usman Ali, Amir Arshad
Abdulghani, Ahmad Al-Maashari, and Said Al-Abri with the
A. Addition Circuit author on these projects is greatly appreciated.
The designs of nibble-size complex binary adder circuits
have been presented in [9,10]. In [9], Jamil et. al. have
presented hardware implementations of both minimum-delay
and ripple-carry adders on Xilinx FPGAs and compared their REFERENCES
performance with ordinary base 2 adder designs. The
conclusion is that CBNS minimum-delay adder is 32% faster
than base 2 minimum-delay adder, and that CBNS ripple- [1] D. Knuth, An imaginary number system, Communications of the
ACM, 1960, pp. 245-247.
carry adder is 4% faster than base 2 ripple-carry adder. In
[2] W. Penney, A numerical system with a negative base,
[10], Goode et. al. have used state machine approach to Mathematical Student Journal, May 1964, pp. 1-2.
design a CBNS adder circuit. [3] W. Penney, A binary system for complex numbers, Journal of the
ACM, April 1965, pp. 247-248.
B. Subtraction Circuit [4] V. Stepanenko, Computer arithmetic of complex numbers,
Cybernetics and System Analysis, 1996, Vol. 32, No. 4, pp. 585-591.
The design of a nibble-size complex binary subtractor [5] T. Jamil, N. Holmes, and D. Blest, Towards implementation of a
circuit has been presented in [11]. In this paper, a minimum- binary number system for complex numbers, Proceedings of the
delay subtractor has been designed and implemented on IEEE SoutheastCon 2000, Nashville, Tennessee (USA), April 7-9,
Xilinx FPGAs. 2000, pp. 268-274.
[6] T. Jamil, The complex binary number system basic arithmetic
made simple, IEEE Potentials, December 2001/January 2002,
C. Multiplier Circuit Vol. 20, No. 5, pp. 39-41.
The design of a nibble-size complex binary multiplier [7] D. Blest and T. Jamil, Efficient division in the binary representation
of complex numbers, Proceedings of the IEEE SoutheastCon 2001,
circuit has been presented in [12] wherein a minimum-delay Clemson, South Carolina (USA), March 30-April 1, 2001, pp. 188-
multiplier circuit has been designed and implementation 195.
statistics for Xilinx FPGAs have been presented. [8] D. Blest and T. Jamil, Division in a binary representation for
complex numbers, International Journal of Mathematical Education
in Science and Technology, 2003, Vol. 34, No. 4, pp. 561-574.
D. Divider Circuit [9] T. Jamil, B. Arafeh, and A. Al-Habsi, Hardware implementation and
The design of a nibble-size complex binary divider performance evaluation of complex binary adder designs,
Proceedings of the 7th World Multiconference on Systemics,
circuit has been presented in [13] wherein Boolean Cybernetics, and Informatics (SCI 2003), Orlando, Florida (USA),
expressions for all the outputs in sum-of-minterms form have July 27-30, 2003, Vol. II, pp. 68-73.
been presented. [10] J. Goode, T. Jamil, and D. Callahan, A simple circuit for adding
complex numbers, WSEAS Transactions on Information Science
and Applications, July 2004, Vol. 1, No. 1, pp. 61-66.
V. CONCLUSION AND FUTURE RESEARCH [11] T. Jamil, A. Abdulghani, A. Al-Maashari, Design of a nibble-size
CBNS is expected to be the binary number system of the subtractor for (-1+j)-base complex binary numbers, WSEAS
Transactions on Circuits and Systems, July 2004, Vol. 3, No. 5,
future because of extensive applications of complex numbers pp. 1067-1072.
in various electrical and computer engineering areas and the [12] T. Jamil, A. Al-Maashari, and A. Abdulghani, Design and
need to find an efficient representation of these numbers for implementation of a nibble-size multiplier for (-1+j)-base complex
storage and manipulation. With the designs of various binary numbers, WSEAS Transactions on Circuits and Systems,
arithmetic circuits for CBNS already available in the November 2005, Vol. 4, No. 11, pp. 1539-1544.
scientific literature, it is now possible to design a processor [13] T. Jamil and S. Al-Abri, Design of a divider circuit for complex
based on this number system. An Australian Innovation binary numbers, Proceedings of the World Congress on Engineering
and Computer Science 2010/International Conference on Circuits and
Patent No. 2010100706 incorporating CBNS arithmetic units Systems, San Franscico, California (USA), October 20-22, 2010,
in the associative dataflow processor has been granted to the Vol. II, pp. 832-837.

232