Any assembly programmers here?
#11
Ashkael,Dec 2 2004, 05:48 PM Wrote:Hmm? How can multiplication not be commutative?

Edit: Talking about crappy routines

I'm guessing that it would be something to do with the low order bits.
As an example, on a machine with an 8 bit accumulator, of you want to perform 16*16*(1/16) (doing shift for division) you will get an overflow if you do the two multiplications first, since 256 doesn't fit in an 8 bit accumulator, but if you do 16*(1/16)*16 you get the correct answer. Unfortunately, if you do 15*16*(1/16) in the way that worked in the above example (15*(1/16)*16) you will get the 'wrong' answer due to loss of precision, but would have been fine if you multiplied the two numbers first before the division.
Reply


Messages In This Thread
Any assembly programmers here? - by Ashkael - 11-28-2004, 06:41 AM
Any assembly programmers here? - by LavCat - 11-28-2004, 10:24 AM
Any assembly programmers here? - by Ashkael - 11-28-2004, 07:51 PM
Any assembly programmers here? - by LavCat - 11-29-2004, 03:13 AM
Any assembly programmers here? - by whyBish - 11-29-2004, 04:48 AM
Any assembly programmers here? - by whyBish - 11-29-2004, 05:06 AM
Any assembly programmers here? - by kandrathe - 11-29-2004, 04:48 PM
Any assembly programmers here? - by Ashkael - 12-02-2004, 04:42 AM
Any assembly programmers here? - by Ashkael - 12-02-2004, 04:45 AM
Any assembly programmers here? - by Ashkael - 12-02-2004, 04:48 AM
Any assembly programmers here? - by whyBish - 12-03-2004, 12:42 AM
Any assembly programmers here? - by whyBish - 12-03-2004, 12:45 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)