|Anonymous | Login||04-03-2020 20:47 UTC|
|Main | My View | View Issues | Change Log | Docs|
|Viewing Issue Simple Details [ Jump to Notes ]||[ View Advanced ] [ Issue History ] [ Print ]|
|ID||Category||Severity||Reproducibility||Date Submitted||Last Update|
|0006438||[Squeak] Collections||major||always||04-22-07 19:46||09-10-08 17:35|
|Summary||0006438: Interval>>reverseDo: is broken|
interval>>reverseDo: is broken when the upper bound of the interval is not one of its element.
For example, (1 to: 10 by: 2) reverseDo: executes the block for elements 10, 8, 6, 4, and 2.
Tests and a fix are attached.
Maybe reverse: should be re-defined on Intervals to answer an Interval, then foo reverseDo: could be defined as foo reverse do:
Rounding errors may cause clight inconsistencies if one uses floating point numbers with intervals.
|Attached Files||IntervalReverseDoFix.1.cs [^] (1,371 bytes) 04-22-07 19:46|
SYSTEM WARNING: Creating default object from empty value
(0010625 - 589 - 831 - 831 - 831 - 831 - 831)
Yes, do define reverse as
^(self last) to: (self first) by: step negated
Interval on Float are not recommended.
But the #do: loop would work better on Float with:
value := start + (n*step).
value := value + step.
And the reverseDo: would then just iterate n from self size-1 downto 0
Float Interval size would then be consistent with the do loop.
Try for example
| x |
x := (1.0 timesTwoPower: 53).
(x to: x + 2) size.
x to: x+2 do: [:i | Transcript cr; show: i printString].
Current implementation result in an infinite loop...
(0012623 - 211 - 229 - 229 - 413 - 413 - 413)
This patch seems to have been harvested in Squeak 3.10 image and could be closed.
The alternative solution described in above note can be found at 0006456 .
Note that 0006456 applies both to #do: and #reverseDo:
(0012624 - 541 - 553 - 553 - 553 - 553 - 553)
Thanks Nicolas. Before closing this I'd like to at least try to figure out in what update this was harvested. Having this sort of information is helpful in later investigations.
If you would in this sort of case when you discover that maybe the status of an issue needs to be changed, it would be helpful to set the status to Feedback. Also for anything that was harvested in 3.10, you can assign it to me as I've taken on the job of getting all these closed. If Mantis doesn't let you do that let me know and I will try to change it.
(0012625 - 45 - 45 - 45 - 45 - 45 - 45)
|Harvested in update 7107, released with 3.10.|
|04-22-07 19:46||black||New Issue|
|04-22-07 19:46||black||File Added: IntervalReverseDoFix.1.cs|
|04-29-07 13:19||nicolas cellier||Note Added: 0010625|
|09-09-08 21:15||nicolas cellier||Note Added: 0012623|
|09-10-08 17:25||KenCausey||Note Added: 0012624|
|09-10-08 17:25||KenCausey||Assigned To||=> KenCausey|
|09-10-08 17:25||KenCausey||Status||new => feedback|
|09-10-08 17:35||KenCausey||Status||feedback => closed|
|09-10-08 17:35||KenCausey||Note Added: 0012625|
|09-10-08 17:35||KenCausey||Resolution||open => fixed|
|09-10-08 17:35||KenCausey||Fixed in Version||=> 3.10|
|10-03-09 20:29||nicolas cellier||Relationship added||related to 0006456|
|08-21-10 13:10||nicolas cellier||Relationship added||child of 0007002|
| Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
62 total queries executed.|
43 unique queries executed.