« Solfeggio - John Dunn, Consultant, Ambertec, P.E., P.C. | Main | Loop Current - Improved Understanding - Dick LaRosa »

June 18, 2011

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Bill St.John

Interesting but...
What if the result is negative?
23-47 = -24 (standard arithmetic)
23+52 = 75 (9s complement addition)

The method falls apart here BUT if we take the result of the 9s complement addition and do a 9s complement again, we get 24.

John Dunn

Hi, Bill.

I don't know how to deal with neagtive results either, it's always been a larger number take away a smaller number for me.

However, this process works in any base including binary for which ones-complment arithmetic is used.

For example: 1011 - 101 = 110 in plain subtrection.
Then: 1011 + 1010 = 10101 --> 0101 + 1 = 110 Correct.

Bing

The method is (assuming x and y contain 4 digits):

x - y = x + (10000 - y) = 10000 + (x - y)

Therefore dropping the leading 1 gives you the correct result.

If (x - y) is negative, you just have to take the 9's complement again:

(e.g. 9's complement of 75 is 24)

Bing

My previous comment should read:

The method to calculate (x - y) is:

x + (10000 -y) = 10000 + (x - y)

(assuming x and y contain 4 digits)

Note that (10000 - y) us the 10's complement of y, or 9's complement + 1. Dropping the leading 1 gives you the correct result.

If (x - y) is negative, you just have to take the 9's complement again:

10000 - (10000 + (x - y)) = -(x - y)

Just be aware that the result is a negative value
(e.g. 9's complement of 75 is 24, and the actual result is -24)

Hope this clear things up.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Comments are moderated, and will not appear until the author has approved them.

Your Information

(Name and email address are required. Email address will not be displayed with the comment.)

Editor

  Learn about our  

 free engineering 

consulting referral 

      service at:

 

  IEEE Consultant's 

      Network of 

     Long Island

 

We have over forty 

electrical, electronic, 

mechanical and 

software engineers 

with expertise in more 

than sixty-five categories 

of technology and business. 

All are members of the 

IEEE and adhere to the 

IEEE professional codes 

of ethics. 

No fee is charged for the

referral service. 

Each member is an 

independent consultant 

and negotiates his/her 

own consulting agreement.

 

Editor: Jerry Brown

Contributors:

John Dunn

Marty Kanner

Murray Kleiner

Dick LaRosa

David Pinkowitz

Carl Schwab

Gerry Bodner

Larry Rachman

 

Unless otherwise noted, 

reprinting or republication 

of anarticle on this blog is 

authorized by crediting the 

author and prominently 

displaying the following 

sentence at the beginning 

or end of the article,

including the hyperlink to

IEEE Consultant's Network 

of Long Island


"This report is republished 

with permission of IEEE 

Consultant's Network of 

Long Island"

 

Pages

Blog powered by Typepad

Enter your email address:

Delivered by FeedBurner