1
$\begingroup$

I have an HW question where I found an answer that matches mine, but their breakdown confuses me.

Ques: What is 4365 - 3412 when these values represent unsigned 12-bit octal numbers? The result should be written in octal. I used binary and then looked up the Octal to obtain 753

Found solution: 4365-3412 = 0753 This is because 5-2 = 3 (makes sense), 6-1 = 5 (yep), 8+3-4=7 #we need a carry here, since 3<4 and 4-4=0

I can see where they got 8 (I think) 3+5=8, but why did they do that and how are we getting a carry for the ending of 4-4=0. Appreciate any help/reference.

$\endgroup$
4
  • $\begingroup$ where they got 8 since your base is 8, you have $43_8 = 4 \cdot 8 + 3 = 3 \cdot 8 + (3 + 8)$). I mean, it's the same thing as in base 10: e.g. when computing $53 - 34$, for the last digit you'll compute $10 + 3 - 4 = 9$, and for the first digit: $(5 - 1) - 3 = 1$. How are we getting a carry for the ending of 4-4=0 - it should be $(4-1)-3=3-3=0$. $\endgroup$
    – user114966
    Apr 16, 2021 at 21:09
  • $\begingroup$ (3+5=8 did you start adding result digits? Do you do that using a different representation, say, decimal?) $\endgroup$
    – greybeard
    Apr 17, 2021 at 6:41
  • $\begingroup$ In this context it's called borrow, not carry. $\endgroup$ Apr 19, 2021 at 6:21
  • $\begingroup$ They are using the usual subtraction algorithm. I assume that you know how to subtract numbers in decimal. It is precisely the same algorithm, only in a different base. $\endgroup$ Apr 19, 2021 at 6:21

2 Answers 2

1
$\begingroup$

$$\begin{matrix}&4&3&6&5\\&\scriptsize\color{green}{-1}&\scriptsize\color{green}{+8}\\-&3&4&1&2\\\hline&0&7&5&3\end{matrix}$$

There is a borrow from the "thousands" to the "hundredths".

$\endgroup$
6
  • $\begingroup$ borrow from the "hundreds" to the "thousands" $\endgroup$
    – greybeard
    May 11, 2023 at 20:39
  • $\begingroup$ @greybeard: I wonder. The one is borrowed from the thousands and lend to the hundreds. $\endgroup$
    – user16034
    May 12, 2023 at 7:19
  • $\begingroup$ I'd argue carries are from lower significant place to higher, and convention in using borrow follows suit here (higher significance place lending to lower, lower borrowing from higher would be closer to common usage, I guess). But not least, I suggest not to use hundredths. $\endgroup$
    – greybeard
    May 12, 2023 at 7:22
  • $\begingroup$ @greybeard: based on web search, I'll stick to the idea that borrows are left-to-right while carries are right-to-left. $\endgroup$
    – user16034
    May 12, 2023 at 7:31
  • $\begingroup$ I may have neglected arithmetic&CS lately compared to electronics design, where borrow is just a signal and direction undisputed. $\endgroup$
    – greybeard
    May 12, 2023 at 7:35
0
$\begingroup$

Thanks everyone! I believe I came to the right conclusion after the responses: 4365 = 4 x 8^3 + 3 x 8^2 + 6 x 8^1 + 5 x 8^0 2048 + 192 + 48 + 5 = 2293

3412 = 3 X 8^3 + 4 x 8^2 + 1 X 8^1 + 2 X 8^0 1536 + 256 + 8 + 2 = 1802

2293-1802 = 491 or OCT 753

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.