<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 27 Feb 2016, at 01:12, Erica Sadun via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><font class="">I have a problem with the way floating point ranges work with striding:</font></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font class=""><font face="Courier" class="">1.0.stride(through: 2.0, by: 0.1)</font></font><span style="font-family: Palatino-Roman;" class=""> returns the sequence [1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9]. </span></blockquote><blockquote class="" style="font-family: Palatino-Roman; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div class=""><i class="">Documentation: "It returns the sequence where last is less than or equal to `end`." </i></div></blockquote><font face="Palatino-Roman" class=""><div class="">(And yes, the same issue exists with tradition C-style for loops).</div></font></div></div></blockquote><div><br class=""></div><div>The documentation is a bit weird. <i class="" style="font-family: Palatino-Roman;">"It returns the sequence where last is less than or equal to `end`.” </i>seems to tacitly assume that we’re talking about the longest possible sequence with that property. With your proposed <i class="" style="font-family: Palatino-Roman;">"It returns the sequence where last is greater than or equal to `end`?” </i>we’re now talking about the shortest possible sequence with that property.</div><div><br class=""></div><div>But what do you mean “no change for integers”? What about 1.stride(through: 10, by: 8)? Wouldn’t that return [1, 9] now and [1, 9, 17] with your change?</div><div><br class=""></div><div>—S</div></div><br class=""></body></html>