<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></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 Mar 19, 2016, at 4:10 PM, Gavin Eadie via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><div class=""><div dir="ltr" class=""><div class=""><div class=""><font face="arial, helvetica, sans-serif" class="">Finally, I'll note that when SE-0007 was being considered, I asked how I might do the second case</font></div></div></div></div></blockquote><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class=""><font face="arial, helvetica, sans-serif" class="">(I needed to span Doubles from X to Y in jumps of Z. The best answer (of several), at that time, was:</font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><br class=""></font></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(187,44,162)" class=""> extension</span> <span style="color:rgb(112,61,170)" class="">ClosedInterval</span> <span style="color:rgb(187,44,162)" class="">where</span> Bound: Strideable {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">func</span><span style="" class=""> by(n: </span>Bound<span style="" class="">.</span>Stride<span style="" class="">) -> </span>StrideThrough<span style="" class=""><</span>Bound<span style="" class="">> {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> <span style="color:rgb(187,44,162)" class="">return</span> <span style="color:rgb(112,61,170)" class="">start</span>.<span style="color:rgb(61,29,129)" class="">stride</span>(through: <span style="color:rgb(112,61,170)" class="">end</span>, by: n)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> }</div></div><div class=""><br class=""></div><div class="">and </div></div></div></div></blockquote><br class=""></div><div>Right now, I believe floating point strides are broken. I started working on a proposal to address this by </div><div>moving them into their own stride implementations instead of genericizing them with integers.</div><div>(<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0050-floating-point-stride.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0050-floating-point-stride.md</a>)</div><div><br class=""></div><div>After talking with Dave Abrahams, it looks like he's going to be able to address the issue as a</div><div>part of his indexing model work. I have withdrawn the proposal.</div><div><br class=""></div><div>Spanning doubles from X to Y in jumps of Z is particularly problematic in traditional for loops</div><div>because of the errors accumulated at each iteration. There are more details about this issue </div><div>in the proposal link.</div><div><br class=""></div><div>Swift has many use-cases where we don't really mind if there are minor calculation errors </div><div>because the real-world experience of the user doesn't change (did that timer fire 0.0001 seconds early?),</div><div>other use-cases that are inherently decimal in nature (currency, many graphing applications, where</div><div>0.1 and 0.25 matter), and still yet others where calculation errors matter but the numbers</div><div>aren't nicely decimal (trigonometry, among others). Swift should support these all.</div><div><br class=""></div><div>-- E</div><div><br class=""></div></body></html>