Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/13/01 21:20
Read: times


 
#17620 - RE: fastest 32 bit division
Dividing both dividend and divisor by 2 (right shift) until both are reduced to managebale 8-bit numbers, and then usng the 8-bit divide gives a fairly accurate result (in my experience, if both values are comparable in bit length, the quotient/integer part of the result is on the dot)
Done properly the error can be reduced to +/- 1 bit.
If the error is too much,you can rectify using MUL and ADD operations

e.g. Try this:
if A and B = two 32-bit values
Do
{a = A/2
b = B/2}
until (a and b = 8-bit)
q1 + r1/b = a/b ;tentative result

e = A - (q1*b + r1)
;e is the error in the first division
Or u can try :
f = A -(q1*B + r1*(B/b))

you can manipulate these values to give amazingly accurate results, and highly optimize the algorithm for your operating range.

Kundi

List of 12 messages in thread
TopicAuthorDate
fastest 32 bit division            01/01/70 00:00      
RE: fastest 32 bit division            01/01/70 00:00      
RE: fastest 32 bit division            01/01/70 00:00      
RE: fastest 32 bit division            01/01/70 00:00      
RE: fastest 32 bit division            01/01/70 00:00      
RE: fastest 32 bit division            01/01/70 00:00      
RE: fastest 32 bit division            01/01/70 00:00      
RE: fastest 32 bit division            01/01/70 00:00      
RE: fastest 32 bit division            01/01/70 00:00      
RE: fastest 32 bit division            01/01/70 00:00      
RE: fastest 32 bit division            01/01/70 00:00      
RE: fastest 32 bit division            01/01/70 00:00      

Back to Subject List