[Newbies] Re: Interval>>copyFrom:to:
nicolas.cellier.aka.nice at gmail.com
Mon Dec 13 22:59:41 UTC 2010
Bert Freudenberg <bert <at> freudenbergs.de> writes:
> It would only be more efficient if it ever got used. Can't imagine a case
where this would be useful. It would
> add complexity to the implementation though.
> - Bert -
"Speaking of complexity, beware if you ever mess with intervals of Floats...
Oh, one should better learn to not expect too much from these.
Here is an example of stupid problem quite hard to make right...
...just try it in a workspace."
start := 1.
increment := Float epsilon + 0.5.
stop := 10.
c1 := start to: stop by: increment.
(c1 copyFrom: 4 to: c1 size) = ((c1 at: 4) to: stop by: increment).
((c1 copyFrom: 4 to: c1 size) collect: [:e | e hex])
= (((c1 at: 4) to: stop by: increment) collect: [:e | e hex]).
"If you feel comfortable with Floats, I have some extra works:
Could you find an increment producing the requested interval in this case ?
Does such increment exist in the general case ?
Good luck ;)
More information about the Beginners