Pentium M 1.86 GHz 2MB Cache 533 MHz FSB
Cygwin under Windows XP
Pi calculation 42 seconds. 23 seconds with -O2 calculation...
Wierd... Looks like we need to look at the algorithm, make sure it actually does calculate Pi. Maybe timers don't work on Cygwin either....
UPDATE: Yes the algorithm is correct. Here's the original source code: spigot algorithm for the Digits of \pi, Stanley Rabinowitz and Stan Wagon, Amer.Math.Monthly, March 1995, 195-203 soft version at
http://paul.rutgers.edu/~rhoads/Code/pi2.cHere's an updated version without the looping stuff and restructured a little.
I suggest you compile it with
gcc -o cpuwars2 cpuwars2.c
and run it like this
date|cut -c 12-20;./cpuwars2;date|cut -c 12-20
so you can compare the system clock with the program report... of course the system clock will always be longer because of overhead, but if it's a factor of 2 then something is wrong with the timer functions.
And raise the number of iterations back up... I cut it down but I don't wanna re-upload.
[verwijderd door de beheerder]