• Support PF! Buy your school textbooks, materials and every day products Here!

A Question About Base 3 Subtruction

  • #1
1,395
0
i cant understand how it works:
i have two bit numbers (x1 x0 ,y1 y0) which are needed to be subtructed

i cant understand why
x1 x0 y1 y0 | B D1 D2
0 0 0 1 | 1 1 0
0 0 1 0 | 1 0 1
0 0 1 1 | X X X


i cant understand these arithmetics
the first one is 0-1=-1
so in base 3 the resolt is should be three but i cant understand what meen Borrow=1
and the resolt 10
i dont understand how did they desided that

and why we have dont cares on the third example
 

Answers and Replies

  • #2
HallsofIvy
Science Advisor
Homework Helper
41,792
920
i cant understand how it works:
i have two bit numbers (x1 x0 ,y1 y0) which are needed to be subtructed

i cant understand why
x1 x0 y1 y0 | B D1 D2
0 0 0 1 | 1 1 0
0 0 1 0 | 1 0 1
0 0 1 1 | X X X


i cant understand these arithmetics
the first one is 0-1=-1
so in base 3 the resolt is should be three but i cant understand what meen Borrow=1
and the resolt 10
i dont understand how did they desided that

and why we have dont cares on the third example
Base 3? It looks to me like you are working in base 2!

However, even in base 3, the "result" of a calculation is never "3". It might be 103 (where the 3 indicates the number is written in base 3) but the only digits ("trigits"?) in base 3 are 0, 1, and 2.

Oh, wait, I see. You are doing base 2, binary, arithmetic, but assuming that you can only keep 3 bits, the first being the "sign bit". What you are you are doing is is binary arithmetic (base 2) with the computer notation "two's complement" for negative numbers. Looks like a very simple example of what happens in a computer with 16 bits per number.

Specifically, 0- 1= -1 whether you are in decimal or binary. In "twos complement" negative numbers are represented by having the first bit 1 (positive numbers always have the first bit 0. It's called the "sign bit".) and the rest of the bits the complement of the corresponding positive number. The number "1" would be 001 in this form so "-1" is : first the "sign bit" becomes 1, the the complement of 01 is 10, so -1 is represented by 110.

For the second problem, 0- 10= -10 so the "sign bit" becomes 1 and the complement of 10 is 01: -2 is represented by 101.

For the third, 0- 11= -11 so the "sign bit" becomes 1 and the complement of 11 is 00. The result is 100.

The advantage of "twos complement" is that you don't have to "borrow". But if you want to use "borrowing", its exactly what you learned in elementary school. To subtract 14 from 31 you think "since 4 is larger than 1, I have to borrow 10 from the 10s place. Of course, the "3" in the 10s place really represents 30. Borrowing 10 from the 10s place leave 20- so "2" in the 10s place- and gives 11 in the units place. 11- 4= 7 so you have 7 in the units place. 2- 1= 1 so you have 1 in the 10s place: 31- 14= 17.

It's exactly the same in binary.
 

Related Threads for: A Question About Base 3 Subtruction

Replies
7
Views
3K
  • Last Post
Replies
10
Views
1K
Replies
2
Views
2K
Replies
3
Views
1K
  • Last Post
Replies
5
Views
1K
  • Last Post
Replies
2
Views
965
  • Last Post
Replies
0
Views
1K
  • Last Post
Replies
4
Views
1K
Top