Chronology Current Month Current Thread Current Date
[Year List] [Month List (current year)] [Date Index] [Thread Index] [Thread Prev] [Thread Next] [Date Prev] [Date Next]

[Phys-L] Re: Division via subtractions



Although I agree with most of what Denker has said on this topic, I take
some offense at his statement "...[division by subtraction] as a
practical algorithm it is laughable..."

I have stated I have used division by subtraction in some
assembly-language programming, and John's statement could be construed
that I was pretty stupid to do so.

Indeed, the two modern Digital Signal Processors I have worked with
both do division by subtraction. I doubt either TI or Analog Devices
would consider it laughable. I think if they had a better way to do
it, they would, as it might put substantially more money in their
pockets. I hesitate to say that perhaps all processors do it this way
on the machine level, because I don't want to be accused of Bold
Assertion Without Proof.

Of course, division is extremely expensive on a DSP because of this
method. Typically, a 16-bit division takes 16 clock cycles, whereas
multiplication takes one clock cycle, and can include an accumulation
if you like. Thus, if you can get away with some pre-processing,
division is done (much) faster by multiplying by a "magic" number and
down-shifting.


Stefan Jeglinski