<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Mar 10, 2017 at 4:16 AM, David Sweeris via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br>I’m ok with doing it as an extension on `Comparable`, although we should add an overload for regular ranges, too.</div><div><br></div><div>- Dave Sweeris</div></div></blockquote><div><br></div><div>How would the semantics of that work?</div><div><br></div><div>Should “16.clamped(to: 0..&lt;10)” produce 9 or 10?</div><div><br></div><div>What about “16.clamped(to: 0..&lt;0)”, which is an empty range?</div><div><br></div><div>Does “16.0.clamped(to: 0..&lt;10)” yield 10.0 or the next-smaller representable Double?</div><div><br></div><div> Nevin</div></div></div></div>