At 11:21 -0500 11/30/99, Jarvis, Robert P. wrote:
-----Original Message----- From: Peter Crowther [SMTP:Peter.Crowther@IT-IQ.com] Sent: Tuesday, November 30, 1999 9:25 AM To: 'squeak@cs.uiuc.edu' Subject: RE: Intervals
You're still assuming steps at, or of the order of, 1.
<sigh> Guilty as charged. I also confess to having missed an edge condition. Dare I hope for a velvet rope with which to be hung, m'lud? :-)
'From Squeak2.6 of 11 October 1999 [latest update: #1559] on 30 November 1999 at 11:07:18 am'!
....SNIP...
I do think that #includes:, if allowed for an interval, should answer true for all values that 'anInterval asArray' includes (or, the equivalent, the set values passed to a #do: block) and false for others. This is not unreasonable and someone else today posted a solution (the same method that's in Collection).
However, it cannot be done with a simple computation. Fudge factors can only make it look right for your test cases. Try this interval with your code:
(1.0e-200 to: 5.0e-200 by: 1.0e-200) asArray => (1.0e-200 2.0e-200 3.0e-200 4.0e-200 5.0e-200 )
Aren't floats fun! :-)
Dave _______________________________ David N. Smith IBM T J Watson Research Center Hawthorne, NY _______________________________ Any opinions or recommendations herein are those of the author and not of his employer.