0

I have to multiply 9820 and 4823 in 14- Complement. I know that the result is C7A75060, but I don't know how to get there. My problem occurs when I have to multiply 8 with 4823, I get 2893A, but I know it's wrong. How do I go with this?

Angela
  • 1
  • Maybe you could explain (or refer to a web page) what you mean by 14-Complement Multiplication? It doesn't seem to be a standard programming term. – JohanC Aug 13 '20 at 08:06
  • @JohanC: It's like twos-complement arithmetic but [generalized to higher bases](https://en.wikipedia.org/wiki/Method_of_complements). – President James K. Polk Aug 13 '20 at 17:37
  • @PresidentJamesK.Polk Many thanks for clarifying. The complements part seems to be related to negative numbers, for which also a fixed number of digits needs to be set. So, one might interpret the question as just being about base-14 calculation? – JohanC Aug 13 '20 at 17:47
  • @JohanC: That is how I am interpreting it. I'm not sure where the complement business comes in, if at all. Maybe for overflow? – President James K. Polk Aug 13 '20 at 18:11

1 Answers1

1

You have to be careful with base-complement to track how many digits you have, so you know which digit contains the (notional) sign. Assuming here you are (trying) to mulitply 4-digit base-14-complement to get an 8-digit base-14-complement, you need to treat to top digits carefully. So the 9 and 4 are sign digits, and 9 denotes a negative number. So the problem is likely in your last step when you try to mulitply 9 with 4823, which you should actually do as -5 * 4823 = -18CB1 = C512D. Combining that with the other partial products you get

 0 * 4823 =    00000
 2 * 4823 =   09246
 8 * 4823 =  2893A
-5 * 4823 = C512D
           ---------
            C7A75060

another equivalent way of doing this is to treat the sign as a (extra) independent digit:

 0 * 4823 =     00000
 2 * 4823 =    09246
 8 * 4823 =   2893A
 9 * 4823 =  2D35D
-1 * 4823 =  95BB
            ---------
             C7A75060
Chris Dodd
  • 119,907
  • 13
  • 134
  • 226