[FIX] IntervallNewFromFix-reposted
marcus at ira.uka.de
marcus at ira.uka.de
Tue Jan 20 20:28:52 UTC 2004
from preamble:
"Change Set: IntervallNewFromFix-reposted
Date: 14 January 2004
Author: Marcus Denker
md: just reposting as changeset. Original Message:
Subject: [FIX] Interval class>>newFrom:
Author: Richard A. O'Keefe
Date Posted: 31 May 2002
Archive ID: 6326
Comments: In Squeak 3.0.1, try
Interval newFrom: (1 to: 1)
You expect a fresh copy of (1 to: 1). You GET a division by 0.
This is because the implementation starts
| newInterval |
newInterval := self from: aCollection first to: aCollection last
by: (aCollection last - aCollection first) // (aCollection size -
1).
If aCollection size = 0, this errs instead of returning an empty
Interval.
If aCollection size = 1, this gets a divide-by-zero.
Instead, it should read
| newInterval n |
(n := aCollection size) <= 1 ifTrue: [
n = 0 ifTrue: [^self from: 1 to: 0].
^self from: aCollection first to: aCollection last].
newInterval := self from: aCollection first to: aCollection last
by: (aCollection last - aCollection first) // (n - 1).
Has this already been fixed in 3.2?
"!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IntervallNewFromFix-reposted.cs.gz
Type: application/octet-stream
Size: 815 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040120/8c24ae0b/IntervallNewFromFix-reposted.cs.obj
More information about the Squeak-dev
mailing list
|