subtractio

Uh...how deep into the realm of fundamental digital electronics and binary arithmatic do you want to go???

Perhaps you could state your specific problem and situation. The calculator program on my PC works great, and our PLCs do subtraction all the time without messing up...
 
lol...

Ok, the quick answer is because it saves a bunch of programming and hardware design if you simply tell the computer how to add, and then let it add a number to a negative number, instead of telling it how to add AND subtract.
 
Just ask the peasants

The lack of subtraction back in 2 BS was the basis for the whole class warfare thing. You see, without subtraction, money could only be ADDED to the king's coffers, not subtracted. So the peasants pumped all their worldly possesions up to the king and got nothing back from him.

Wait a minute....that still happens! Never mind.
 
The easy answer is:

They do.
Every architecture that I've written assembly for
(x86, SPARC, 68HC11, MPC505, Alpha, ....) has had some sort (usually many different) subtract opcode(s).

Of course, I'm sure there are some simpler processors out there that only have an add instruction that is used for subtraction.

As TCIG pointed out, subtraction is the same as the addition of the negated operand.

I hope this answered your (poor) question.
 
Breaking news!

They can't divide either.......But like TCIG points out:

Somehow the pixy dust they spray on the calculators works it all out.

Seriously:
The "Al-Gore-Rhythm" ( did I spell that right? )to accomplish correct subtraction and division is nothing more than curious class lecture in college...and NEVER contemplated in the real world.

I did hear about a job where a square root needed to be extracted from a PLC that only had 4 functions ( add subtract muliply and divide ).....I would have to dust off my 6th grade math book to accomplish that I am afraid....we are spoiled. Do I have any takers on that algorithm?

Simon LaPlace developed his method of dissolving diffy-Qs when he was 16 years old to calculate the obirbital velocities of the planets. My 16 year old can't cut the grass. ( We all know somebody more spoiled that we are )
 
Logic,

Rather than referring to the multiplication tables which I committed to memory int the fourth grade, if I obtain the solution to 5 x 2 = ? by adding log(5) + log(2) and calculating 10 raised to the power of the result, would you say I didn't multiply?

Could negating one term and adding the result to the other term be a working definition of subtraction?
 
Re: Breaking news!

Steve D said:
I did hear about a job where a square root needed to be extracted from a PLC that only had 4 functions ( add subtract muliply and divide ).....I would have to dust off my 6th grade math book to accomplish that I am afraid....we are spoiled. Do I have any takers on that algorithm?
You didn't say who could play.

In motion control one must have a square root function to any trivial application. Velocity^2 = 2*Acceleration*Distance or Velocity = sqrt(2*acceleration*distance).

I have a routine I use on our 16 bit controller that takes the square root of a 32 bit integer in about 8 microseconds.


My DSP does not have a divide instruction or square root function yet it can divide or find the square root in less than a microsecond using Newton's method for finding roots.

Work this out on your calculator
Code:
    Guess(n+1)  = (Guess(n)^2+Number)/2*Guess(n)
To take the square root of a Number make a good Guess and work through about 7 iterations at most. With a good guess you can get close with 3 iterations.

I have more ways.


BTW, in the year 2 BS I worked on a HP1000. It was called a mini computer back then. I called it a crippled instruction set computer because it did not have a subtract I would have to this:

Code:
    LDA      B           ; LOAD NUMBER BEING SUBTRACTED.
    CMA,INA              ; COMPLEMENT AND INCREMENT REGISTER A
    ADDA     A           ; ADD THE NUMBER BEING SUBTRACTED FROM
    STA      C           ; C = A - B

Notice the HP1000 didn't have a negate instruction either. It had microcode that allowed the HP to do two very simple things in one instruction.
 
Yo Peter!!!

I got my start in Automation with Measurex, the CA based pulp and paper measuement and control specialists. They eventually got absorbed by Honeywell I think...but for 7 years I looked after HP2100's with 32k, 16 bit (w/2bit parity) ferrite core memory.

On more than one occasion I loaded a program on one machine and then walked the plant with a stack of these cards (about 10 kg of them!) and plugged them into another HP whose loader had failed.

Real programming was cutting several k of hand assembled code and patching into the main thread...ON THE FLY...with a fully running papermachine (plus homicidal superintendent) throbbing in the background.
*
ah the nostalgia seeing your HP1000 code.

Is it true that NASA used these HP puppies in the Apollo Lunar Landing Module??
 
STOP STOP STOP

I think the thread starter just wants to provoke us into a neverending and unproductive series of posts.
Dont fall for it. Let THIS post be the last one in this thread.
 
Back
Top Bottom