[squeak-dev] Integer>>isPrime why reverting Knuth's algorithm
P (probabilistic primality test) with iteration over division with even
numbers?
Andres Valloud
avalloud at smalltalk.comcastbiz.net
Thu Dec 24 20:53:34 UTC 2009
The problem I see is one of confusion. If you ask an integer isPrime,
then it would be reasonable to expect a deterministic answer, not a
probabilistic one.
On 12/20/2009 4:19 AM, Enrico Spinielli wrote:
> Again my point is:
>
> was there a problem to solve?
> Was it about performance?
>
> If the answer is YES, then a fix (your proposal for example) is needed
> if NOT leave what was there originally...double implementation is just
> making maintenance more difficult.
> Optimizing for the sake of it has never proved correct...
>
> My 2 cents...
> Bye
> Enrico
>
> On Sat, Dec 19, 2009 at 11:18 PM, Cédrick Béler <cdrick65 at gmail.com
> <mailto:cdrick65 at gmail.com>> wrote:
>
> or simply
>
> SmallInteger>>isPrime
> the current version
>
> LargePositiveInteger>>isPrime
> Knuth's version
>
>
> --
> Cédrick
>
>
>
>
>
>
> --
> Enrico Spinielli
> "Do Androids dream of electric sheep?"— Philip K. Dick
> "Hear and forget; see and remember;do and understand."—Mitchel Resnick
More information about the Squeak-dev
mailing list
|