[BUG][FIX] Interval method includes:

Boris Gaertner Boris.Gaertner at gmx.net
Tue Jun 15 14:22:14 UTC 2004

This bug report is for Squeak 3.7beta latest update 5954
This is NOT a dramatic bug

The inclusion test does not work for intervals with a negative
step. To see the problem, you can try this:

 (-1 to: -111 by: -1) includes: -100

This answers false. 

To find the element, you can evaluate this statement:
 (-1 to: -111 by: -1) indexOf: -100 

This answers 100, which is obviously the right answer.
The test
   (-1 to: -111 by: -1) at:  100 
confirms this.

The bug is in method valuesInclude: where we use the signed step,
scale it and compare it with an absolute value. We have to use the
absolute value of the step, too.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: IntervalInclusionFix.2.cs
Type: application/octet-stream
Size: 734 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040615/9eadcb30/IntervalInclusionFix.2.obj

More information about the Squeak-dev mailing list