Remarkable results with psyco and sieve of Eratosthenes
Gabriel Genellina
gagsl-py at yahoo.com.ar
Wed Nov 29 20:07:22 EST 2006
At Wednesday 29/11/2006 20:35, Steve Bergman wrote:
>BTW, strictly speaking, shouldn't I be adding something to the floating
>point sqrt result, before converting to int, to allow for rounding
>error? If it is supposed to be 367 but comes in at 366.99999999, don't
>I potentially classify a composite as a prime?
You could avoid sqrt using divmod (which gets the % result too); stop
when quotient<=divisor.
But this approach creates a tuple and then unpacks it, so you should
time it to see if there is an actual speed improvement.
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
More information about the Python-list
mailing list