Re: A85: Square roots


[Prev][Next][Index][Thread]

Re: A85: Square roots





  if you want an algorithm that does primes, try this:
 n = number to check
 i = looping variable
 for(i=2 ; (i*i) <=n ;  i = i+1)
  if mod(n, i)==0 then the number is not prime 
 otherwise, it is

the check for i*i being less than or equal to the number replaces the need
for a square root, although the code for a square root function would be
nice to have.
	
						                 Erik Huizing
						     ehuizing@acs.ucalgary.ca
					     http://www.ucalgary.ca/~ehuizing

On Fri, 10 Oct 1997, Max Thoursie wrote:

> 
> Hi!
> 
> Does anybody know a fast way of calcing out squreroots in z80 asm?
> 
> (need it for primes)
> 
> /Max Thoursie  erdol@hem2.passagen.se
> 


References: