Bob Fehrenbach wrote: > Maybe someone can make it smaller or faster and we could all > benefit. Bob: I'd make the following changes right off the bat... They'll save 3 words of program space and a few cycles of execution time per iteration: > subwf n_b, w > movwf t_b > bc xx SKPC > incf t_a, f INCFSZ T_A > bnz xx GOTO XX > incf t_x, f INCF T_X > xx: > movf t_a, w > subwf n_a, w > movwf t_a > bc yy SKPNC > incf t_x, f -Andy P.S. Have you noticed that your routine behaves inconsistently when evaluating the square root of, say, (x*x)-1? If x is even, the routine returns x-1; if x is odd, it returns x. At least, it behaves this way in the "equivalent" QuickBASIC program I just whipped up... For all I know, my QB code could be wrong. Would you mind checking this? Andrew Warren - fastfwd@ix.netcom.com Fast Forward Engineering, Vista, California http://www.geocities.com/SiliconValley/2499