Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Mar 2002 13:04:26 -0300
From:      "flagbh" <flagbh@bol.com.br>
To:        freebsd-bugs@FreeBSD.ORG
Subject:   changed a freebsd source code
Message-ID:  <GT4KNE$I7l_REtPMen8iLkSGP9AAWd_U_vO5sFGsmP@bol.com.br>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]



__________________________________________________________________________
Quer ter seu próprio endereço na Internet?
Garanta já o seu e ainda ganhe cinco e-mails personalizados.
DomíniosBOL - http://dominios.bol.com.br

[-- Attachment #2 --]
/*
Hi, I made a slighty improvement on the code of prime.c 
which is at:
ftp://ftp.freebsd.org/pub/FreeBSD/development/FreeBSD-CVS/src/contrib/top/prime.c%2Cv

The affected part is now 1.14 faster
*/

#include <math.h>

main(argc, argv)

int argc;
char *argv[];

{
    double i, j;
    int f;
    double k; //new variable	

    if (argc < 2)
    {
        exit(1);
    }

    i = atoi(argv[1]);
    while (i++)
    {
        f=1;
        for (j=2; j<i; j++)
        {
            //start of affected part

	    k = i/j; //new line	

            if (k==floor(k))      //changed line, the old was:/* if ((i/j)==floor(i/j)) */
	    //end of affected part 		 	
            {
                f=0;
                break;
            }
        }
        if (f)
        {
            printf("%.0f\n", i);
            exit(0);
        }
    }
}

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?GT4KNE$I7l_REtPMen8iLkSGP9AAWd_U_vO5sFGsmP>