Re: Simple integer math benchmark
- Posted by ed_davis Dec 06, 2013
- 5880 views
fizzpopsoft said...
What do they say... ?
There are lies, bloody lies and benchmarks! ;)
But thanks for the effort.
I did say take it with a grain of salt
fizzpopsoft said...
Pity there is no Java on that benchmark.
I can do something about that .....
class primes { public static void main(String[] args) { int n, lim; int k; int pc; boolean is_prime; pc = 0; n = 1; lim = 5000000; while (n < lim) { k=3; is_prime=true; n=n+2; while ((k*k<=n) && (is_prime)) { is_prime=n/k*k!=n; k=k+2; } if (is_prime) { pc = pc + 1; } } System.out.print(pc); } }
1.48 seconds.