News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

I looked at this and decided to do -5 * -4 in binary.

Started by Evan, December 10, 2013, 02:40:05 PM

Previous topic - Next topic

Evan

I messed up.
http://fourier.eng.hmc.edu/e85_old/lectures/arithmetic_html/node9.html


I messed up again.

I think it is:
111011
111100
_______
     000000
    000000
   111011
  111011
111011
111011
_______
1111 0111100100


I read my code
left to right
first I count the ones
second I count the zeros
third I count the ones' segments
forth I count the zeros' segments

.

Please let me know why I am wrong.

My programmer calculator says -5 * -4 is -1. Weird.


Due to my calculator I think I need to take 15864 - (my code) to correct the result.

gelatine1



Do 4*5 instead and then take 2's complement. The thing marked in yellow should be your result. EDIT: don't take 2's complement...
For binary multiplications I.
would suggest this algorithm http://en.wikipedia.org/wiki/Multiplication_algorithm#Peasant_or_binary_multiplication
In fact it is just the same as long multiplication though.

Evan

Quote from: gelatine1 link=topic=2708.msg28757#msg28757 date=1386674654 #delete image from above


Do 4*5 instead and then take 2's complement. The thing marked in yellow should be your result. EDIT: don't take 2's complement...
For binary multiplications I.
would suggest this algorithm http://en.wikipedia.org/wiki/Multiplication_algorithm#Peasant_or_binary_multiplication
In fact it is just the same as long multiplication though.

In my system's calculator the number I found for -20 doesn't matter after many ghost errors. What you showed me I do not understand.

Evan

Should we explain long multiplication to each other on smaller number scales?
Should we use the decimal point in our long multiplication?


Please move this to the romper.