[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Performance again



oops, i forgot the source :

HJ

Herwin Jan Steehouwer
  herwinjs@palet.nl                 http://www.caiw.nl/~herwinjs
  steehouwer@kde.org              KDE developer http://www.kde.org 
/* cc perftest.c -o perftest */

int main(argc,argv)
int argc;
char **argv;
{
	int a=5000000;

	if(argc==2 && argv[1][0]=='f') {
		float val1=2.0, val2=1.3, val3=1230.4;

		while(a--) {
			val1*= (val2*val2 + val3)/(val2);
			val1/= (val2*val2 + val3)/(val2);
		}
		printf("float\n");

	}
	if(argc==2 && argv[1][0]=='i') {
		float val1=2;
		int val2=13, val3=1230;

		while(a--) {
			val1*= (val2*val2 + val3)/(val2);
			val1/= (val2*val2 + val3)/(val2);
		}
		printf("mixed int\n");

	}
	if(argc==2 && argv[1][0]=='d') {
		double val1=2.0, val2=1.3, val3=1230.4;

		while(a--) {
			val1*= (val2*val2 + val3)/(val2);
			val1/= (val2*val2 + val3)/(val2);
		}
		printf("double\n");

	}
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []