MedVision ad

I am absolutely not getting how you can just minus a binary (1 Viewer)

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
ok i've been seeing this in Sam other peoples working out for my questions how on earth can you just minus a binary number????


i don't get the logic, wat's the rules, i fort the only method of subtraction is changing the number to the two's comp and adding it.
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
ok i searched up on it


and i understand the basic


0 - 0 = 0
1 - 0 = 1
1 - 1 = 0
0 - 1 = 1 (borrow a 1 from the digit next to it )

but my big issue is what happens if u can't borrow a digit next to it because there's nothing to borrow for example


1000
1001
 

Glide

Member
Joined
Oct 13, 2003
Messages
103
Is this for your option topic or SDD as a whole?

Havnt really focused much on binary, argh! not really keen on doing it in the exam either :(
 

-X-

Member
Joined
Aug 10, 2003
Messages
481
Gender
Undisclosed
HSC
N/A
lol MS calculator gives "111111111111111111111111....." as the answer.
 

saves.the.day

Member
Joined
Oct 29, 2003
Messages
233
Location
Castle Hill
Gender
Undisclosed
HSC
2003
Originally posted by Glide
Is this for your option topic or SDD as a whole?

Havnt really focused much on binary, argh! not really keen on doing it in the exam either :(
No no, its for the option topic "Software Developers view of hardware" in the sub-section "binary arithmetic". If you're doing the other option of evolution of programming languages (assuming it has no dot point covering binary arithmetic) you should be fine.
 

Rahul

Dead Member
Joined
Dec 14, 2002
Messages
3,647
Location
shadowy shadows
that would be a negative number would it not, i dont think that is in the syllabus, not sure but.

as long as you do something like

10000
- 1001

then you should be fine i think
 

fatmuscle

Active Member
Joined
Jul 6, 2002
Messages
3,707
Location
Hornsby
Gender
Male
HSC
2001
1000 - 1001 = you're pretty screwed in calculation by hand.

if you look at my notes, they'll confuse you even more if you were taught by australian schooling, learning how to subtract with the cross method.
 

saves.the.day

Member
Joined
Oct 29, 2003
Messages
233
Location
Castle Hill
Gender
Undisclosed
HSC
2003
Couldn't you just convert the second element to a ones or twos complement then add the two numbers together? I'm using the logic:

x - y = x + (-y)
where -y is simply the ones complement or twos complement.
 

fatmuscle

Active Member
Joined
Jul 6, 2002
Messages
3,707
Location
Hornsby
Gender
Male
HSC
2001
or u could just switch the numbers around, then put a negative infront of your answer?

1000 - 1001 --> 1001 - 1000

= -1

*shrugs*
 

SamD

Member
Joined
Jul 21, 2002
Messages
256
Gender
Male
HSC
N/A
Originally posted by -X-
lol MS calculator gives "111111111111111111111111....." as the answer.
MS Calculator uses the twos complement system and 1111111111... is the twos complement representation of -1 in normal binary.

Everyone seems to be confusing normal binary numbers with twos complement binary, they are different systems!

1. Lets do 1000-1001 in normal binary:
This is the decimal subtraction 8 - 9, which you would not attempt directly in decimal, rather you'd do what fatmuscle said and do 9-8 then make the answer a negative. The same applies in binary, so the answer in binary is -1.

2. Now in twos complement:
In twos complement the range of numbers wraps around to form a circle. So with 8bits the range is -128 to 127 (10000000 to 01111111), however if you add 1 to 127 you end up at -128 (this is an example of overflow). This wrap around means that you can do subtractions like 1000-1001 with twos complement.

If its a 4bit twos complement system then using normal subtraction you get:
1000 -
1001
--------
1111
(Does this need more explanation!)

Sam
 

Glide

Member
Joined
Oct 13, 2003
Messages
103
Originally posted by saves.the.day
No no, its for the option topic "Software Developers view of hardware" in the sub-section "binary arithmetic". If you're doing the other option of evolution of programming languages (assuming it has no dot point covering binary arithmetic) you should be fine.
Great, im doing evolution :)
Thanks for the heads up, I thought we didnt cover it in class!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top