A simple sieve in Phobos?
bearophile
bearophileHUGS at lycos.com
Sun Mar 30 16:40:13 PDT 2014
safety0ff:
> I think we need a solid integer math module more than anything
> on this list.
> I find myself often reimplementing ilog2, isqrt, isPowerOf2,
> etc, etc.
I implemented many of those in my old D1 nonstandard library. I
still port some of them to D2 now and then. So I agree they are
needed.
> I think we should be careful about adding an isPrime method, I
> think adding an isProbablePrime plus the prime sieve should
> cover most use cases.
This is an interesting opinion. Can you explain why an isPrime is
less useful than a isProbablePrime (like this:
http://en.wikipedia.org/wiki/Miller-Rabin_primality_test ) plus a
sieve? Can't you have both a isPrime and a isProbablePrime in
Phobos?
Bye,
bearophile
More information about the Digitalmars-d
mailing list