nicolas if you produce a slice I will integrate them. For now I'm focusing on emptying the pending stack of fixed items
Stef On Oct 25, 2009, at 4:53 PM, Nicolas Cellier wrote: > 2009/10/25 Nicolas Cellier <[email protected]>: >> 2009/10/25 Andres Valloud <[email protected]>: >>> >>> isPrime >>> >>> | guess guessSquared delta selfSqrtFloor | >>> self <= 1 ifTrue: [^self error: 'operation undefined']. >>> self even ifTrue: [^self = 2]. >>> guess := 1 bitShift: self highBit + 1 // 2. >>> [ >>> guessSquared := guess * guess. >>> delta := guessSquared - self // (guess bitShift: 1). >>> delta = 0 >>> ] whileFalse: [guess := guess - delta]. >>> guessSquared = self ifFalse: [guess := guess - 1]. >>> selfSqrtFloor := guess. >>> 3 to: selfSqrtFloor by: 2 do: [:each | self \\ each = 0 ifTrue: >>> [^false]]. >>> ^true >>> >>> >>> Also, the above code can be used to implement sqrtFloor and >>> sqrtRounded >>> in Integer. I am sure Nicolas Cellier remembers this :). >> >> If http://bugs.squeak.org were not down, I would even provide a link >> with these enhancements >> > > google says it should be > http://www.google.fr/bugs.squeak.org/view.php?id=7099 > . > Or go to the source > http://blogten.blogspot.com/2008/06/drove-to-reno-today.html > http://blogten.blogspot.com/2008/06/update-on-sqrtrounded.html > > >>> >>> Andres. >>> >>> _______________________________________________ >>> Pharo-project mailing list >>> [email protected] >>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >>> >> > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
