[squeak-dev] Squeak 4.5 error: #isPrime fails with relatively small Mersenne prime

David T. Lewis lewis at mail.msen.com
Tue Feb 10 12:39:31 UTC 2015


On Tue, Feb 10, 2015 at 02:39:19AM -0700, Lawson English wrote:
> This bit of code fails at numb := 1024:
> 
> error: Cannot truncate this number
> 
> numb := 1024.
> 1 to: numb do: [:n||test| test:=(2 raisedTo: n) -1. (test isPrime) 
> ifTrue: [Transcript show: n; tab; show: test;cr]]
> 
> #isProbablyPrime fails with the same number.
> 
> 
> numb := 1023.
> works for both.
>

It looks like a problem in random number generation. It is failing in
LargePositiveInteger>>atRandom which somehow results in the random
generator producing a value of Float infinity.

Dave



More information about the Squeak-dev mailing list