in reply to Re (tilly) 3: Fast Multiplication
in thread Fast Multiplication

You meant mult2 is slower, as in O($b), right? cause thats what i thought.. The original algorithm shown i believe runs @
O(log2 $b). As you said, there are certain occasions when multiplication is not so slow, such as times 0, 1, or 2. Thats pretty much the pattern i found for this algorithm. I noticed, (this was originally in C, mind you, and was purely conjtectural) hey, instead of multiplying by 2, i can just shift the bits 1 to the left, to multiply by 4, just shift 2 bits to the left, etc.. i just noticed that using bitwise manipulators, i could use that speed of multiplying by powers of 2 (2n, shift n to the left), which are very fast operations, so that i would have to add numbers much less than with the latter subroutine. anyway, i have the feeling i'm beating a dead horse here, so i think i'll leave it at that for now :)