On Sun, Jan 12, 2003 at 01:46:52AM +0100, Thomas Harte wrote in widescreen:
> There is an entire web page somewhere dedicated to getting fast sqrts. I've 
> seen one 
> which uses only a 256 or 512 byte table but can do a 16bit sqrt in less than 
> 100 cycles.

Don't know how that works, but just out of interest, the fastest
pure-code integer sqrt routine I know (producing an 8-bit number
from a 16-bit input) has a loop of a bit over 100 cycles executed
8 times.  It's based on this:

    x=arg(1)/2**16
    p=0
    do 8 
       x=4*x  
       p=p+p
       if x >= p+1 then do
          x=x-(p+1)
          p=p+2
       end
    end
    p=p/2
    return p

imc (who isn't here really)

Reply via email to