From: Mel Patrick <mel@...>

Date: Tue, 18 Nov 1997 11:06:49 -0800

Date: Tue, 18 Nov 1997 11:06:49 -0800

>>>Can someone give me the basics of binary addition and subtraction? I think >>>I understand (and can do) binary addition, but subtraction is giving me >>>fits. >>> >>>Thanks, >>>*Chris >> >>I can give you a DA that I wrote that does it for you...(being a programmer >>means being inventive). It also means that the battery on the 506L >>scientific calculator went dead once too often...;-) >> >>Mel Patrick - theWabbitGuy - mel@... >>http://www.intergate.bc.ca/business/mel > >Well, I need to know how to do it myself :) I've got a calculater (both on >the comp and hand held) that will do binary addition/subtraction etc, but >let's just say I want to know for my own edification. Okay, cept the calc I have shows you all the binary numbers. The one you are adding, the one you are subtracting and what the result it. All at the same time. You can change any single digit and recalc to see how it affects the answer. Its a good little learning two tool... specially if you're doing AND OR NOT and masking... Oh, yea, its free too... But if you want to know how to do it long hand, its the same as decimal. Except you can't go over 1. When you borrow, its not 10's, its 1. So : 10 decimal minus 8 decimal (and yea the answer is two) : 0000000000001010 - 10 0000000000001000 - 8 ----------------- 0000000000000010 - 2 On the other hand if you wanted to 10 - 12, you'd get an overflow condition cause you're in the negative portion of the binary world. i.e. there's nothing to borrow from. Mel Patrick - theWabbitGuy - mel@... http://www.intergate.bc.ca/business/mel