A Question About Base 3 Subtruction

  • Thread starter Thread starter transgalactic
  • Start date Start date
  • Tags Tags
    Base
Click For Summary
SUMMARY

The discussion centers on the complexities of subtraction in base 3 and binary arithmetic, particularly focusing on the concept of borrowing and two's complement representation. The user initially confuses base 3 with binary operations, leading to misunderstandings about the results of subtraction. The explanation clarifies that in binary, negative numbers are represented using two's complement, where the sign bit indicates positivity or negativity. The examples illustrate how borrowing works in binary subtraction, akin to elementary school arithmetic.

PREREQUISITES
  • Understanding of binary arithmetic and two's complement representation
  • Familiarity with base systems, particularly base 2 and base 3
  • Knowledge of sign bits in binary numbers
  • Basic subtraction techniques, including borrowing
NEXT STEPS
  • Study the principles of two's complement in binary arithmetic
  • Learn about base conversion techniques between different numeral systems
  • Explore binary subtraction methods, including borrowing
  • Investigate the implications of sign bits in computer science
USEFUL FOR

Students and professionals in computer science, particularly those focusing on digital logic design, binary arithmetic, and number representation in computing.

transgalactic
Messages
1,386
Reaction score
0
i can't understand how it works:
i have two bit numbers (x1 x0 ,y1 y0) which are needed to be subtructed

i can't 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 can't understand these arithmetics
the first one is 0-1=-1
so in base 3 the resolt is should be three but i can't understand what meen Borrow=1
and the resolt 10
i don't understand how did they desided that

and why we have don't cares on the third example
 
Physics news on Phys.org
transgalactic said:
i can't understand how it works:
i have two bit numbers (x1 x0 ,y1 y0) which are needed to be subtructed

i can't 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 can't understand these arithmetics
the first one is 0-1=-1
so in base 3 the resolt is should be three but i can't understand what meen Borrow=1
and the resolt 10
i don't understand how did they desided that

and why we have don't 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.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 3 ·
Replies
3
Views
923
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K